When working on one project, it was necessary to stylize form elements (drop-down lists, checkboxes, and radio buttons).
After looking at a
selection of solutions , I stopped at
this option .
')
There is an experience of using niceforms, but during the implementation I had to suffer with drop-down lists, because it was necessary to change them dynamically upon the occurrence of certain events; besides, the behavior of these lists differs from the behavior of browser lists + more than half of the niceforms code was simply superfluous for this task (the input and file selection fields were not styled).
The chosen solution has a small code size and drop-down lists are used by “almost” browser based ones.
Unfortunately, this solution is also not without flaws.
One of them (the stylization of lists in IE6 does not work) was overcome, persuading the client to leave selects in IE6 :)
Among the disadvantages are the lack of support for labels that are tied to form elements and the absence of a disabled state.
The task also required to create new selects and apply styling to them, for which the methods of creating individual elements were highlighted.
A little conjuring, it turned
out that's what .
Besides:
- rendered styles from document.write;
- check if (value == true) replaced by if (value) :);
- fixed the declaration of local variables.
Link to the script itself.ps Possible bugs, with pleasure I will take into account the comments.