English 中文(简体)
选择使用吉克语的具体修正
原标题:select specific decendants using Jquery
  • 时间:2012-05-08 03:53:22
  •  标签:
  • jquery

http://api.jquery.com/child-selector/“rel=”nofollow。 JQuery s Documentation,,"jun > child" , 选定或选择“子女”所指明的“父母”具体内容的所有直接儿童要素。 “目标儿童”只是一个层次。 例如,我有这一法典:

    ...
    <table class="advanceSearch">
      <tr>
        <td>
          <ul class="form">
            <li>
              <label>Document Type:</label>
              <input type="text" id="cmbDocumentType" name="paramtitle" />
            </li>
            <li>
              <label>Title:</label>
              <input type="text" id="paramtitle" name="paramtitle" />
            </li>
            <li>
              <label>Notes:</label>
              <input type="text" id="paramNotes" name="paramNotes" />
            </li>
            <li>
              <label>Revision Number:</label>
              <input type="text" id="paramRevisionNumber" name="paramRevisionNumber" />
            </li>
            <li>
              <label>Draft Number:</label>
              <input type="text" id="paramDraftNumber" name="paramDraftNumber" />
            </li>
            <li>
              <label>Version Number:</label>
              <input type="text" id="paramVersionNumber" name="paramVersionNumber" />
            ...

我想从“第1段”开始,从“第2条”开始,从中选取<条码>、<代码>而不是<条码>、儿童选择器:

      $("table.advanceSearch").find("ul.form").find( input[id^="param"] ).attr("disabled", "disabled");

这一工作良好,但我发现,它有两条<条码>限定(选择器。 是否有办法为之 short?

最佳回答

您实际上不需要<代码>.find();相反,你可以使用两名后代的挑选人。

$( table.advanceSearch ul.form input[id^="param"] )

摘录:x > y (the child selectedor) is more-orless interchangeable with $ (x ).children( y ), and $(x y ) is more-orless interchangeable with $ (x ).find( y )

问题回答

Your selector can be much longer:

$(".advanceSearch input[id^= param ]").prop("disabled", true);

这样做是一样的,没有两岸。

引证:

$( table.advanceSearch ul.form input[id^="param"] ).prop( disabled , true);

页: 1

$( table.advanceSearch ul.form ).find( input[id^="param"] ).prop( disabled , true);

页: 1

$( table.advanceSearch ul.form li ).children( input[id^="param"] ).prop( disabled , true);




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...