jquery - How to Change the Contents ("value") of a Custom Attribute -


i have following html5 custom attribute:

<input ... class="my-input" data-counted="n"> 

how change value (from "n" "y") in jquery?

here have , not work:

$(document).on('change', '.my_input', function() {     $(this).attr('data-counted').val('y'); }); 

you can use

$(this).attr('data-counted','y'); 

or

$(this).data('counted','y'); 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -