开发者

jQuery find elements with value = x

I need to remove element that have value="123". I know that all elements with different values are located in #attached_docs, but I don't know how to select element with value="123".

$('#attached_docs').find ... .remove();
开发者_C百科

Can you help me?


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

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

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();


The following worked for me:

$("[id=attached_docs][value=123]")


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

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


$(selector).filter(function(){return this.value==yourval}).remove();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜