button.trigger('click');
doesn't seem to work.
There's also no trigger method in the docs.
Is the only way to set the classes manually?
Thanks.
Edit:
Oh actually not specific enough in asking, sorry. My button is a radio.
button.trigger('click');
doesn't seem to work.
There's also no trigger method in the docs.
Is the only way to set the classes manually?
Thanks.
Edit:
Oh actually not specific enough in asking, sorry. My button is a radio.
You can call $('#thebutton').click();
but it is important to note that does not simulate a browser-level click; it only invokes any jQuery-assigned click handlers for that button. Anything added outside of the jQuery sandbox will be ignored.
That should work... There is no no trigger method in the docs of jQuery UI simply because it's still the same on how you do it normally on jQuery. I mean the following codes can demonstrate it to you.. see also demo.
<div class="demo">
<button>A button element</button>
<input type="submit" value="A submit button"/>
<a href="#">An anchor</a>
</div><!-- End demo -->
<button id="trigger">Trigger Submit button click</button>
$(function() {
// make button()
$("button, input:submit, a", ".demo").button().click(function(){
alert('from button() : I was triggered!');
});
// add click handler..
$('input:submit').click(function(){
alert('a submit button being triggered');
});
// prevent default operation of an anchor
$("a", ".demo").click(function() { return false; });
// trigger click on submit button
$('#trigger').click(function(){
$('input:submit').trigger('click');
});
});