简体   繁体   中英

Button on click event is not working

I use button onClick event which seems that its not working like I expect ,

I've read many post in SO and try many things but its still not working ,what can couse this issue?

<input type="button" value="button text" onclick="CallFunc()" />

Any idea,why?

HTML:

<input id="myButton" type="button" value="button text"/>

jQuery:

$("#myButton").click(function(e){
  //your codes
});

I think that it's better to use something like following

Give an ID to your button/table/etc ,here is example.

var $table = $("#dataTable").

Then call to the function like following

  $table.on("click", ".btn-submit", saveNewRow);

Try it and let me know.

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM