Use LI To Select Radio Input?
I am using a payment button generator for a specific selection of items that creates a pre-made radio list of prices. When you select the amount/item you want, you then click 'con
Solution 1:
If JQuery is allowed:
$('li').click(function() {
$(':radio[data-price-id="'+$(this).data('level')+'"]').prop('checked', true);
});
Just give list items appropriate attributes:
<li id="item1" data-level="1"><div>my content</div></li>
<li id="item2" data-level="2"><div>my content</div></li>
EDIT: If you can't change HTML structure, try with this:
$('li').click(function() {
index=$(this).index();
$(':radio').eq(index).prop('checked', true);
});
Post a Comment for "Use LI To Select Radio Input?"