如何使用jQuery启用相应的列字段

时间:2019-12-19 14:19:29

标签: javascript jquery html

我通过克隆在表中添加行。选择“选择”字段后,其余字段将被启用。我遇到的问题是,如果我再次更改我以前的“选择”字段的值,那么我当前的行字段将被启用。任何帮助将不胜感激。谢谢

jQuery

function disableField()
    {
    var Count = $('#dataTable tr').length;
    if (Count == 2){
    $("input").not('.DeleteButton').prop('disabled', false);
        }
        else{
        $("input").prop('disabled', false);
        }}

HTML

<table border="0" cellspacing="1" cellpadding="1" id="dataTable" class="graphtable">
  <thead>

    <tr>
      <td class="headingalign" width="16%">Links</td>
      <td class="headingalign" width="32%">Desciption</td>
      <td class="headingalign" width="16%">Image</td>
      <td class="headingalign" width="16%">URL</td>
      <td class="headingalign" width="05%"></td>

    </tr>
  </thead>
  <tbody>

    <tr id="id0" class="vals" name="row">

      <td>
      <div class="id_100">
    <select type="select-one" id='fldsearch' class="objselect" name="fldsearch" onChange="disableField()" >
        <option value="">Select</option>
        <xsl:for-each select="faml/response/quicklinkresponsedto/searchby/datamapdto">
            <xsl:sort order="ascending" select="description"/>
            <option value="{datavalue}-{description}">
                <xsl:value-of select="description"/>
            </option>
        </xsl:for-each>
        </select>
     </div> </td>
      <td>
        <input id="flddesc" name="flddesc" maxlength="500" disabled="true" class="objinputtext1" size="85" value="{//RESPONSE}"  />

      </td>
      <td>
        <input  id="fldimg" name="fldimg" maxlength="50" disabled="true" class="objinputtext2" size="35" value="{//RESPONSE}"  />

      </td>
      <td>
        <input id="fldurl" name="fldurl" maxlength="15" disabled="true" class="objinputtext3" size="35" value="{//RESPONSE}"  />

      </td>
      <td>
      <input tabindex="6" value="Delete Row" disabled="true" class="DeleteButton"  type="button" />
      </td>
    </tr>
  </tbody>
</table> 
        <div class="buttonarea">
  <ul>
    <li><input tabindex="6" id="Button3" value="Add New Row" class="Buttons" name="Button3" type="button" /></li>
     <li><input tabindex="6" id="Button5" value="Initiate" class="buttons" name="Button5" type="button" onclick="return fnOnSubmit();"/></li>

  </ul>

</div>

0 个答案:

没有答案