That the input is not editable text box (editable) three methods

  1. disabled attribute should be disabled a predetermined input element, the input element is disabled, can not be edited, not copied, can not be selected, can not receive focus, the background does not pass the received value. After setting the text color turns gray. disabled property can not be used with <input type = "hidden"> .
    Example: <input type = "text" disabled = "disabled" id = "dicttype" /> or $ ( '# dicttype') attr ( "disabled", true) or $ ( '# dicttype') attr ( ".. disabled ", false) is arranged to edit a non-editable;

  2. readonly attribute specifies the input field may be read-only copy, however, the user can use Tab to the field, alternatively, can receive focus, can also select the text or copy it. Background receives the traditional values. Readonly attribute values ​​may be modified to prevent users. readonly attribute with <input type = "text"> or <input type = "password"> conjunction. Example:.. <Input type = "text" readonly = "readonly" id = "dicttype"> or $ ( '# dicttype') attr ( "readonly", true); or $ ( '# dicttype') attr ( " readonly ", false) is arranged to edit a non-editable;

  3. readonly unselectable = "on" with the property similar to disable, input elements, non-editable, not copied, can not be selected, can not receive focus, after setting the text color is grayed out, but the background may pass the received value.

Published 91 original articles · won praise 16 · views 10000 +

Guess you like

Origin blog.csdn.net/fujianmin19910915/article/details/103779346