开发者

Using <input type="slider">

Obviously, <input type="slider"> doesn't exist in the spec, however, I want to use it as a placeholder/identifier for a plugin I'm writing.

This plugin will actually replace the <input> with a load of divs to make a slider similar to jQuery UI's control.

My question is; is using <input type开发者_高级运维="slider"> simply as an identifier of where to place the jQuery-generated code generally "ok" - will it cause issues of any form, or do I need not worry?


HTML5 has this new option, it will only work in newer browsers.

http://html5doctor.com/html5-custom-data-attributes/

Just use

data-whateveryouwanthere

JQuery has ways of manipulating this data also.

http://api.jquery.com/jQuery.data/


It will be OK since browsers render unknown input types as <input type="text">. See this page for reference.

Edit: As discussed in the comments, a better solution for this problem is probably to use class="slider" because that is guaranteed to never have any meaning besides the one you use it for, unlike type="slider" which some browser could potentially decide to render differently.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜