Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select div (or other element) that class contains "grap" (o other specified word) for example

Tags:

First of all; example of HTML code:

<div class"grap1"> some conetent</div>
<div class"grap2"> some conetent</div>
<div class"grap3"> some conetent</div>
<div class"blabla">some content></div>

And now i want to select divs that class contains "grap" word somewhere is class name (so in this case first three divs). How can i achieve that ?

This is not working: http://api.jquery.com/attribute-contains-word-selector/

like image 301
born2fr4g Avatar asked Sep 11 '11 13:09

born2fr4g


1 Answers

Use the attribute contains selector:

$('div[class*="grap"]')
like image 154
Andrei Avatar answered Sep 18 '22 05:09

Andrei