How to find elements with "value = x"?

I need to remove an element with value="123" . I know that all elements with different values ​​are in #attached_docs , but I do not know how to select an element with value="123" .

 $('#attached_docs').find ... .remove(); 

Can you help me?

+61
jquery find attr
Jul 18 2018-11-11T00:
source share
5 answers

If a value is hardcoded in the page source using the value attribute, you can

 $('#attached_docs :input[value="123"]').remove(); 

If you want to target items that have a value of 123 , which was set by the user or programmatically, use EDIT works in both directions.

or

 $('#attached_docs :input').filter(function(){return this.value=='123'}).remove(); 

demo http://jsfiddle.net/gaby/RcwXh/2/

+105
Jul 18 2018-11-11T00:
source share

Value equal to 123:

 jQuery("#attached_docs[value='123']") 

Full link: http://api.jquery.com/category/selectors/

+14
Jul 18 '11 at 11:44
source share

Use the following selector.

 $('#attached_docs [value=123]').remove(); 
+2
Jul 18 '11 at 11:44
source share
 $('#attached_docs [value="123"]').find ... .remove(); 

it should make your need however you cannot duplicate the identifier! remember him

+1
Jul 18 2018-11-11T00:
source share

The following worked for me:

 $("[id=attached_docs][value=123]") 
0
Dec 25 '14 at 12:47
source share



All Articles