开发者

filtering jquery selection with .not

Here is my HTML.

  <code>
    <div id="expfield0">

<div class="formrow">
<div class="formlabel"><label for="Memberresumeexp_Company Name">Company  Name</label> </div>
<div class="formtextfield">
<input size="30" maxlength="128" name="Memberresumeexp[0][companyname]" id="Memberresumeexp_0_companyname" type="text" value="" /> 
<span class="error"> </span>

</div>
</div>


<div class="formrow">
<div class="formlabel"><label for="Memberresumeexp_Title">Title</label> </div>
<div class="formtextfield">
<input size="30" maxlength="128" name="Memberresumeexp[0][title]" id="Memberresumeexp_0_title" type="text" value="" /> 
<span class="error"> </span>
</div>
</div>

<div class="formrow">

<div class="formlabel"><label for="Memberresumeexp_Description">Description</label> </div>
<div class="formtextfield">
<textarea name="Memberresumeexp[0][descr]" rows="8" cols="60"></textarea>
</div>


</div> <!-- end expfield0 -->
    <code>

In jquery I am trying to select the contents of the div expfield0 and then eliminate the textarea from the selection. It is not working. Here is the jquery snippet.

<code>$('#expfield0').not('textarea[name=Memberresumeexp\\[0\\]\\[descr\\]').html()<code>

What am I 开发者_Python百科doing wrong here.


You are selecting #expfield0 itself, not its children, so you can't exclude a particular child from the selection.

If you really want to get the HTML of #expfield0 with the textarea removed, you could do something like this, working on a copy of the element, not the original one:

$('#expfield0')
    .clone()
    .find('textarea')
        .remove()
    .end()
    .html();
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜