javascript - Filter Data Attributes jQuery -
i trying filter list items dependant on data attributes have. please see code below:
html
<li data-process="test 1 ; test 2 ; test 3;">item</li> <li data-process="test 2 ; test 3;">item</li> <li data-process="test 1 ; test 2 ; test 3;">item</li> <li data-process="test 2 ; test 3;">item</li> <li data-process="test 1 ; test 2 ; test 3;">item</li>
js
$('[data-process="test1"]').hide();
so items test 1 hide.
thanks in advance!
use contains selector :
$('li[data-process*="test 1"]').hide();
see fiddle : http://jsfiddle.net/zfdlvndy/1/
but keep in mind can costful retrieve elements that...
Comments
Post a Comment