javascript - Two onclick event -
i have onclick
2 times on same button, button second 1 not seem work. need inorder make both of them work.
<button type="submit" style="display:none;" id="done">ok</button>
1st event
$(document).ready(function () { $('#done').click(function () { }); });
2nd event
$(function () { $(document).on("click", "#done", done); }); function done() { $.ajax({ }); }
i believe need debug issue little bit. title of question indicates javascript (or jquery) not handling click event. may not case.
$(document).ready(function () { $('#done').click(function () { console.log('first') }); }); $(function () { $(document).on("click", "#done", done); }); function done() { console.log('second') } <button type="submit" style="display:block;" id="done">ok</button>
this runs fine, see jsfiddle, console in browser logs both first , second messages. looks both events firing.
you need debug ajax request or controller. try getting simple file (single string within it) , alerting it. can pinpoint exact problem.
Comments
Post a Comment