I used the label tag when I was doing something recently. Since I rarely used the label tag before, I encountered a very strange problem. What's the problem? Let's take a look at an effect Tip: You can modify some of the code before running The purpose of this demo is to verify whether the username and password entered by the user are legal when the login button is clicked. If they are not legal, an error message will be prompted below the username input box. The elements that prompt error information are planned to be implemented using labels. Open the demo page by running the code and click the login button to see what changes will occur. If you are using Firefox, Chrome, or IE9+, after clicking the login button, you will be prompted with "Wrong Username", which is the desired result. If you are using IE6, 7, or 8, how about checking out what changes will occur? At this time, you will find that the page does not prompt any information. Open the developer tools and look at the control. At this time, you will find that the error message "SCRIPT600: unknown runtime error" is prompted. When I encountered this problem, I tried both innerText and innerHTML methods, and found that both methods reported the same error. I thought that the usage was wrong, so I checked on w3cschool and found that it did not say that innerText and innerHTML were not supported. Why does this error appear in IE6, 7, and 8 while Firefox, Chrome, and IE9+ (other browsers have not been tried) run normally? Careful people may be able to see the problem at once. The starting tag of the element that prompts "Wrong Username" is written as "lable" instead of label. But I didn't notice this problem at the time. I always thought there was a problem with the way the label tag was used. As for why the JS engines of IE6, 7, and 8 would have errors when operating the innerText and innerHTMl attributes of such elements with incorrect tag names, while Firefox, Chrome, and IE9+ did not have errors, I am not very clear. If anyone who knows more about this, please explain it to me. This problem is actually quite low-level, the label name was written incorrectly. But I didn't notice it at the time. I only discovered this problem after careful study later, so I still recorded it. |
<<: Detailed process of Vue front-end packaging
>>: Sharing ideas on processing tens of millions of data in a single MySQL table
Table of contents 1. Install Docker 2. Pull the J...
1. Download from the official website and unzip h...
MySQL password modification example detailed expl...
Table of contents Preface LED Trigger Start explo...
Table of contents 1. Download 2. Installation 3. ...
There are two situations 1. Start time and end ti...
1. Add a new user Only allow local IP access crea...
Method 1: Use the SET PASSWORD command MySQL -u r...
1. Referential Integrity Referential integrity re...
Specific method: (Recommended tutorial: MySQL dat...
This article example shares the specific code for...
MySQL is a relational database management system ...
Why use Server-Side Rendering (SSR) Better SEO, s...
Download foreign images using Alibaba Cloud Image...