If you have multiple <a href="#" class="editinline">#</a>
your jQuery
should use on()
to save memory. Add .editinline
selector to attach the function (handler) to multiple elements (in this case — <body>
children)
jQuery('body').on('click', '.editinline', function(){
var now = jQuery(this).closest('tr').find('td.column-special_star').text();
//console.log(now);
if (now.charAt(0)=='S') {now_i = '1';};
if (now.charAt(0)=='N') {now_i = '0';};look like this
//console.log(now_i);
jQuery('#special_star_val').val( now_i );
});
https://jsfiddle.net/47fd3fnu/
If you have single, you can use click()
which is a shortcut to on('click', '...', '...')
:
jQuery('.editinline').click(function(){
..........
});