Select element through part of attribute contained in it

Asked

Viewed 60 times

2

I have an element, for example:

<div class="teste" data-info="isflaolatesteum"></div>

And to select it, I could do it this way:

$(".teste[data-info='isflaolatesteum']")...

However, I want to select this element through the attribute (data-info) only that I have only part of the string contained in the attribute. As in the example above, I would like to select all elements containing teste in the middle of the attribute, that is, it would be like an index in the attribute.

That’s possible?

  • At first it’s all very beautiful, but the headache comes later, I recommend you read this. http://intuio.at/en/blog/dont-use-data-attributes-to-find-html-elements-with-js/

1 answer

2


  • Perfect! Thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.