I'm trying to use jquery to enable a form button only after a radio button has been selected. It's a t-shirt shop where the user is required to choose a size before the 'add to cart' button becomes enabled. The html looks a bit like this:
<input class="radioclick product21" type="radio" name="variation[variation_select_21_1]" value="1">Big
<input class="radioclick product21" type="radio" name="variation[variation_select_21_2]" value="2">Small
<input type="submit" id="product21" class="buy_button" name="Buy" disabled="disabled" value=" ">
So, the submit button is disabled. To enable it when the user clicks a radio button, I use this jquery:
$(function()
{
$('.radioclick').click(function()
{
$('.buy_button').removeAttr('disabled');
$('.buy_button').attr('value', 'add to cart');
});
});
However, that enables ALL the submit buttons on the page (there's lots of t-shirts on the page). The second class name of the radio button is the same as the id of the submit button, so is there a way to use this classname to target the enabling of the specific submit button?
(hope that all makes sense!)