jquery get element by attribute code example
Example 1: jquery get data attribute value
<a data-id="123">link</a>
$(this).attr("data-id")
$(this).data("id")
Example 2: name selector jquery
$('td[name ="tcol1"]')
$('td[name^="tcol"]' )
$('td[name$="tcol"]' )
$('td[name*="tcol"]' )
Example 3: jquery show hide based on data attribute
$('form')
.children()
.filter(function(){
return $(this).data('show') === 'pro';
})
.show();
$('form')
.children()
.filter(function(){
return $(this).data('show') === 'home';
})
.hide();