Jquery Trigger Doesnt Work On Firefox
I'm trying to simulate click event on some element using jQuery when click enter in some textbox: $('input[id$=txtbox]').bind('keypress', function (e) { if (e.keyCode === 13) {
Solution 1:
Trigger
won't work to simulate click
event defined on onclick
attribute on the input
element.
You have to bind
your function to the input in order trigger
to work.
$("input[id$=btn]").bind('click', function() {
alert("I am clicked :)");
});
And now, if you execute $("input[id$=btn]").trigger('click');
. This will work.
Solution 2:
try using a simple html tag instead of asp control.
<input type="button" id="btn" style="display: none;" >
Solution 3:
This works on FF and other browsers, too.
$('input#btn').click();
Post a Comment for "Jquery Trigger Doesnt Work On Firefox"