Ilja
Ilja

Reputation: 46479

JQuery find element that has specific value without loop

I am trying to figure out if there is a way (without using any loops like each etc..) to look up element that has specific value, something like

var myElment = $('.container');
var child = $('.container-child');
myElement.find(child /* That has value of test */);

value is related to .val() of child element, so text inside it.

Upvotes: 0

Views: 168

Answers (1)

maowtm
maowtm

Reputation: 2012

By the Attribute Equals Selector which is [attr=value].

So, to do that, just use

$(".container .container-child[value='test']")

Upvotes: 1

Related Questions