Change the default style of select, and generally use ul and li to simulate it in the situation.
There are many Jquery plug-ins that change the default style of select in this way.
According to the report of the program brother, this method cannot obtain data after form is submitted. Later, after experiments, different JS/Jquery plug-ins were used, and the same result was the same: the data cannot be obtained.
Later, I will look at a blog written by a foreigner. I use the css style to add a div outside the select, set the width of the select less than the width of the parent div, and then change the style of the select default arrow by setting the background property of the div.
This method is a good method, without writing scripts, and is only implemented with simple css.
However, this method is also flawed. In the IE series, when selecting an option, there will be background color blocks, and IE7-IE10 has this bug.
Under Opera, the background image of the div is not displayed, that is, the drop-down arrow of the select is not displayed. I don’t know why this is caused.
The following code
Copy the code