jquery - how to do a status check on a checkbox? -


When a check event is on a checkbox (in one view), I caught it from jquery and checked or its base But on the uncontrolled situation, a database sent a post to the controller to change the field. The line-id should be captured with jquery, what do I try to do with the data-attribute. I got it in a possible way, but it does not work, there is nothing on click.

Can anyone help me please thank you?

See:

  foreach (different items in the model.) {& Lt; Tr & gt; & Lt; Td> @ Html.CheckBox ("check", new dictionary & lt; string, object & gt; {{"class", "myCheckboxes"}, {"data-detection", item.ID}}) & lt; / Td> & Lt; Td> @ Html.DisplayFor (model item => item message) & lt; / Td> & Lt; / TR & gt; }   

jquery:

  $ ('. MyCheckboxes'). Click (function () {var my_id = $ (this) .attr ('data-permission'); if ($ (this) .is (': check')) {// code ...} else {/ / Code ...}});  

I have modified your code to capture a selected checkbox. I'm not sure what I mean with the data-attribute I

  // Subscribe to change events $ (document). ('Change', '. Mycheckboxes', function () {var my_id = $ (this) .attr (' data-detection '); // If checkbox is checked ($ (this) .prop (' Check ')) {// code ...} else {// code ...}});    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -