The input tag is implemented so that the cursor does not appear!

Source: Internet
Author: User

Recently encountered a very worrying problem, I use the input tag, I do not want to let the cursor appear, because the input content is the system given, do not let the user change.

Some people may say, directly with a div to simulate an input out, so that the conditions allow the case is a better choice, but unfortunately, my condition does not allow me to simulate, it must be used input!

At this time it is natural to think of the input tag's ReadOnly property, set on, after the discovery of the click, although the content can not be changed, but there are small cursors appear, if not the cursor is perfect.

So it is natural to think of the disabled attribute, ah, a look, found quite good, in Chrome, FF and IE9 and above the browser, are good, but in IE8 and the following browser, the default to the font is the gray ~ ~ Evil ie!!

In a variety of tangled, finally found a solution in a foreign forum, the original label also has this attribute: unselectable, really omnipotent html!

After testing, according to the following settings, you can achieve the effect of not letting the cursor appear, very useful, examples are as follows:

<input class= "Red" readonlyunselectable= "on" value= "I said I was red" >
<style>
input.red{
Color: #f00;
}

The input tag is implemented so that the cursor does not appear!

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.