Input tag implementation so that the cursor does not appear !, Input tag implementation cursor

Source: Internet
Author: User

Input tag implementation so that the cursor does not appear !, Input tag implementation cursor

Recently, I encountered a very worried problem. When I used the input label, I didn't want the cursor to appear, because the input content is given by the system and won't be changed by users.

Someone may say that it is a good choice to directly use div to simulate an input. However, unfortunately, my conditions do not allow me to simulate, input is required!

At this time, I naturally thought of the readOnly attribute of the input tag. After setting it, I found that the content cannot be changed when I click it, but there is a small cursor. If I don't have this cursor, it will be perfect.

So I naturally thought of the disabled attribute. Oh, well, it looks good. It's good on chrome, FF, IE9 and later browsers, however, in IE 8 and earlier browsers, the font is dimmed by default ~~ Internet Explorer !!

Finally, I found a solution on a foreign Forum. The tag still had this attribute: unselectable, which is a omnipotent html!

After testing, you can prevent the cursor from appearing according to the following settings. The example is as follows:

<Input class = "red" readonlyunselectable = "on" value = "I said I am red">
<Style>
Input. red {
Color: # f00;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.