Wrap Input's Label In Hyperlink Anchor Tag
Solution 1:
Nesting a label
element inside an a
element is not formally forbidden in HTML 4, but neither is its meaning well-defined. It is undefined what happens when the inner element is clicked on. In HTML5 CR, the a
element is for such reasons defined so that no interactive descendant is allowed, and label
counts as interactive.
The best approach is to differentiate the actions, associating them with different elements. It would be poor usability to have a radio button label that has both the expected effect (toggling the button setting) and some completely different effect. But it is not possible to suggest some specific coding, since problem is incompletely defined. For one thing, radio buttons are normally used in groups, and it is unclear whether this radio button really appears as standalone.
Solution 2:
Unsure why not wish to use js/jQuery - code is minimal. It would look like this:
$(function() {
$('#name').click(function() {
$('html, body').animate({scrollTop:$('#gosomewhere').offset().top}, 500);
});
});
And, of course, you must reference the jQuery library in the <head>
tags, like this:
<head><scriptsrc="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script></head>
Post a Comment for "Wrap Input's Label In Hyperlink Anchor Tag"