Home >Web Front-end >HTML Tutorial >The html code text box restricts input. The text box turns gray and restricts input in the text box.

The html code text box restricts input. The text box turns gray and restricts input in the text box.

高洛峰
高洛峰Original
2017-03-01 14:38:572539browse

This article mainly introduces the restriction of input in the html code text box, the text box turning gray, and the restriction of text box input. Friends who need it can refer to it. Method 1: Set the readonly attribute to true.

INPUT value=readonly readOnly

Method 2: Set the disabled attribute to true.

INPUT disabled value=disabled

Method 3: Immediately blur the object when it is focused so that it cannot gain focus.

INPUT onfocus=this.blur() value=onfocus=this.blur()

For more html code text box limit input text box turns gray limit text box input related articles please pay attention to PHP Chinese website!

Statement:
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