javascript - Jquery, how to select an element by its first position value of an attribute -


in html:

<tr data-s=""></tr> <tr data-s="1"></tr> <tr data-s="2 1"></tr> <tr data-s="3 2 1"></tr> 

i'm trying build selector in order trs value of first position of data-s attribute.

thanks in advance.

you can element first position of data-s attribute far understood.

$('[data-s^="3 "]'); 

or if want first position of data-s attribute's value, can this;

$('[data-s]').data('s').split(' ')[0]; 

there a plunker example you.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -