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

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -