I have below radio button on my web,
<input id='element_1_1' name='element_1' class='element radio' type='radio' value='1' />
<label class='choice' for='element_1_1'>2!</label>
<input id='element_1_2' name='element_1' class='element radio' type='radio' value='2' />
<label class='choice' for='element_1_2'> 1 </label>
When user is between the option, I want a check box to appear or a radio bu开发者_开发技巧tton using which user can select 1.5, the radio button should not appear usually only on hover, any ideas how to do it. I am guessing javascript is involved but all results on SO have jQuery in them which I have no idea about
Code implemented here http://jsfiddle.net/xFqf5/2/ By https://stackoverflow.com/users/445303/nick
You can do this by adding display: none
to the styling of the individual radio button and then manipulating it with jQuery's .hover()
and .css()
functions.
Little example:
Button:
<input id='radioButton' name='radioButton' style='display: none' type='radio' value='1' />
<label class='choice' for='radioButton'>1</label>
jQuery stuff:
$('#radioButton').hover(function() {
// blah - show
$('#radioButton').css('display', 'block')
}, function() {
// blah - hide
$('#radioButton').css('display', 'none')
});
精彩评论