Why is the descriptor in the jQuery UI slider a <a> tag?

I read the code on the official demo page for the slider: http://jqueryui.com/demos/slider/ , and I was wondering why the <a> tag is used for the handle? Why not a <div> ?

 <div class="demo"> <div id="slider" class="ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all"> <a class="ui-slider-handle ui-state-default ui-corner-all ui-state-hover" href="#" style="left: 19%; "> </a> </div> </div> 
+6
source share
2 answers

I think they used the anchor because the HTML links have separate HTML code from other markup languages โ€‹โ€‹because they provide interoperability. Taken from w3c

HTML offers many common publishing idioms for rich text and structured documents, but what separates it from most other markup languages โ€‹โ€‹is functions for hypertext and interactive documents. This section provides a link (or a hyperlink or a web link), the main hypertext construct. A link is a connection from one network to another resource. Although a simple concept, link was one of the main forces driving the success of the web.

And the handle is also what you click on, so maybe they thought it was semantically more sensible to use <a> instead of <span> .

To make it clear, I thought that they could use something technically, but they choose the anchor for semantic reasons.

+2
source

I was wondering the same thing ... so I ... with theory!

Pens should be able to have focus
(when they do this, you can use arrows, home and end keys to control the handles)

Not sure if frames or div focus (in all browsers ..)?

Maybe instead of <button> you can use? (anyone please try)
- it will make more sense. And do not clutter the status bar :(
(Can we get into trouble if there is a surrounding form without the right submit button?)

+1
source

Source: https://habr.com/ru/post/912383/


All Articles