jQuery range selector -


i'm searching filter elements range. exemple, element list:

<ul>   <li data-price="25">foo</li>   <li data-price="50">bar</li>   <li data-price="125">baz</li>   <li data-price="150">biz</li> </ul> 

i want extract li data-price >= 50 , <= 125. exist selector can ? if not can simple way ?

you can use .filter() function:

$('ul li').filter(function(){   return($(this).data('price')>=50 && $(this).data('price')<=125) }); 

working fiddle


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -