I have a Div onclick function that calls the JavaScript function below
function MonthViewDay(sDate){
var txtHidden = document.getElementById('<%=txtHidden.ClientID %>');
var btn_Hidden = document.getElementById('<%= btn_Hidden.ClientID %>');
if (txtHidden !== null) {
txtHidden.innerText = sDate;
} else{
alert("Control '<%=txtHidden.ClientID %>' not found.");
}
if (btn_Hidden !== null) {
btn_Hidden.click;
} else {
alert("Control '<%= btn_Hidden.ClientID %>' not found.");
}
}
The problem I am getting is that the btn_Hidden.click is not firing, but the txtHidden text is being update, but the btn_Hidden.click is not firing.
As you can see from my sample, I have a 'test' in place to see if the btn control is found and it is, as far as I can see.
Troubleshooting steps I have taken are,
document.getElementById('<%= btn_Hidden.ClientID %>').click
instead of btn_Hidden.click, no help. Please assist.
Thank you in advance
Rhys
Click is a method not a field in javascript
Simulate a mouse-click use .click()
;
In your code use
btn_Hidden.click();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.