Click here to Skip to main content
15,669,040 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have written code like,

document.getElementById("<%= btnVillageSearch.ClientID %>").click();

To Perform Click Operation which working in Mozilla Firefox, But while coming to IE,

It is not supporting. Please tell me how to perform button click from Java Script for

Updated 11-Oct-12 23:02pm
I.explore.code 12-Oct-12 2:56am    
Are u missing a "#" after "<%"? The other thing u could try is set the clientidmode property to static of the button and then access the id directly in your JavaScript as a literal string. See if that works.

1 solution

var btn = document.getElementById('<%=btnDummy.ClientID%>');;

This is something i have used previously and can confirm it works in IE. , also try moving the the script block to the end of the page, it might also have something to the version of IE you are using.

Or you can try this, this is something i used in Safari which wouldnt otherwise fire the click() event properly
var dispatch = document.createEvent("HTMLEvents")
dispatch.initEvent("click", true, true);

Hope it helps.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900