How to find elements with 'value=x'?

只谈情不闲聊 提交于 2019-11-28 05:35:49

If the value is hardcoded in the source of the page using the value attribute then you can

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

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

or

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

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

Value exactly equal to 123:

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

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

Use the following selector.

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

it should do your need however, you cannot duplicate id! remember it

The following worked for me:

$("[id=attached_docs][value=123]")
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!