Home >Web Front-end >JS Tutorial >What to do if jquery select cannot be edited
The jquery select non-editable solution: 1. Open the corresponding js code file; 2. Replace the drop-down box with input; 3. Remove "readonly="readonly"".
The operating environment of this article: windows7 system, jquery3.2.1 version, DELL G3 computer
#What should I do if jquery select cannot be edited?
js and jquery perfectly solve the drop-down box select which cannot be edited but can pass values
//鼠标移入下拉框将其锁定不可用 $('#下拉框ID').mouseenter(function() { $('#下拉框ID').attr("disabled","true"); }); //移入其他地方锁定解除(本想设置成移出下拉框锁定解除,但不生效,只能改为移入其他地方,大佬可解答下?) $("*[id!='下拉框ID']").mouseenter(function() { $('#下拉框ID').removeAttr("disabled"); });
If allowed, replace the drop-down box with input and use the list attribute
<div class="changeDiv"> <a>性别:</a> <input id="sex" type="text" list="sexlist" readonly="readonly"> <datalist id="sexlist"> <option>男生</option> <option>女生</option> </datalist> </div>
Remove readonly="readonly" and it will be an editable and associateable drop-down box. If you keep it, it will not be editable
Recommended learning: "jquery video tutorial 》
The above is the detailed content of What to do if jquery select cannot be edited. For more information, please follow other related articles on the PHP Chinese website!