Home > Web Front-end > JS Tutorial > body text

What to do if jquery select cannot be edited

藏色散人
Release: 2021-11-11 09:25:24
Original
3350 people have browsed it

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"".

What to do if jquery select cannot be edited

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");
});
Copy after login

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>
Copy after login

Remove readonly="readonly" and it will be an editable and associateable drop-down box. If you keep it, it will not be editable

What to do if jquery select cannot be edited

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template