Home > Web Front-end > JS Tutorial > The text box can only select data into the text box and prohibit manual input_jquery

The text box can only select data into the text box and prohibit manual input_jquery

WBOY
Release: 2016-05-16 17:12:54
Original
1328 people have browsed it

I encountered a problem today in Suzhou. The text box can only be filled with selected data. Manual entry is not possible. Checked the information. The final solution is as follows.

Page code:

Copy code The code is as follows:



Script (giving text Used when assigning values ​​to the box):
Copy code The code is as follows:

$("#id ").removeAttr("readonly"); //Remove the readonly attribute
$("#id").val("Your value");
$("#id").attr("readonly ","readonly"); //Add the readonly attribute

This achieves this small function
[/code]
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