Home >Web Front-end >JS Tutorial >Sharing about jquery dynamic assignment id and dynamic id retrieval method

Sharing about jquery dynamic assignment id and dynamic id retrieval method

小云云
小云云Original
2017-12-30 15:05:444467browse

This article mainly introduces you to the relevant information about jquery dynamically assigning ids and dynamically retrieving ids. The article introduces it in great detail through sample codes. It has certain reference learning value for everyone's study or work. Friends who need it can follow below. Let’s learn together. Hope it helps everyone.

Go directly to the code

This is a piece of code in the datatable to take the id in the table as the only one

 if(row.copy == '1'){
 return '<p><input type="text" id="copyQty&#39;+row.dataCode+&#39;" value="" placeholder="请输入打印数量" class="isAuto" onfocus="copyQtyCheck(this,\&#39;&#39;+row.dataCode+&#39;\&#39;)"/></p>';
 }else{
 return '<p><input type="text" id="copyQty&#39;+row.dataCode+&#39;" value="" disabled="true" placeholder="请输入打印数量" class="isAuto" onfocus="copyQtyCheck(this,\&#39;&#39;+row.dataCode+&#39;\&#39;)"/></p>';
 }

Value

 //是否附件触发
 function copyCheck(doc,dataCode){
  var confirmId="confirm"+dataCode;
  var copyQtyId="copyQty"+dataCode;
  var copyId="copy"+dataCode;
  if($(doc).attr("checked") == "checked"){
   $("#" + copyQtyId + "").val("");
   $("#" + copyQtyId + "").attr("disabled", true);
   $("#" + copyId + "").attr("checked", false);
  }else{
   //点亮附件数输入框
   $("#" + copyQtyId + "").attr("disabled", false);
   $("#" + copyId + "").attr("checked", "checked");
  }
  //点亮确认按钮
  confirmYes(confirmId);
 }

Related recommendations:

Usage of replace() assignment in js

How to assign value to js array in php

phpWhat is the difference between assignment by value and assignment by reference?

The above is the detailed content of Sharing about jquery dynamic assignment id and dynamic id retrieval method. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn