开发者

Javascript "inlet" or "offset" function for drop-list options

开发者 https://www.devze.com 2022-12-31 02:51 出处:网络
I have seen on several sites that drop list values can have offsets... For example this dr开发者_开发知识库op-list:

I have seen on several sites that drop list values can have offsets... For example this dr开发者_开发知识库op-list:

 Fruits
   Apple
   Banana
   Orange
 Colors
   Red
   White
   Black

The above are all options, but some have "inlets" or "offsets" or whatever you want to call it. How is this done with js? (regular js, not jquery at the moment)

Thanks If you need more input let me know.


Are these regular SELECT lists?

In that case, you're talking about <OPTGROUP>


This is not supported by all browser, and those who does support it requires different techniques.

As far as I remember the methods that work are setting the padding of the option, and prepending spaces (' '). But this only work in a few browsers..

0

精彩评论

暂无评论...
验证码 换一张
取 消