jQuery Call Button Click from other Button -
i want call
button click
another button
. if click first button - second button should trigger. have following code.
html:
<input type="submit" name="savebutton" id="first" /> <a href="http://www.google.com/"> <input type="submit" name="savebutton" id="second" /> </a>
jquery:
$(function(){ $('#first').click(function() { $("#second").trigger('click'); // $('#second').click(); wont work either }); });
link fiddle: fiddle
i cant figure out iam doing wrong - can 1 please explain me?
it works don't have handler on second! click event got fired don't should happen...
here code example , fiddle
$(function(){ $('#first').click(function() { alert('button clicked'); $("#second").trigger('click'); }); $("#second").click(function() { alert('button 2 clicked!'); }); });
Comments
Post a Comment