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'+row.dataCode+'" value="" placeholder="请输入打印数量" class="isAuto" onfocus="copyQtyCheck(this,\''+row.dataCode+'\')"/></p>'; }else{ return '<p><input type="text" id="copyQty'+row.dataCode+'" value="" disabled="true" placeholder="请输入打印数量" class="isAuto" onfocus="copyQtyCheck(this,\''+row.dataCode+'\')"/></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!