I changed <a href=""> property on the fly on click on radio button. Now, when I click the a tag.. it is not working as expected.
$('.poll input:radio').each(function() {
$(this).click(function() {
$("#bts_EmailOverlayLink").attr('href','http://qa.makinglifebetterv1.com/offers/doitallmomscontest/default.aspx');
});
});
Please help me out.
Your question is somewhat confusing, but hopefully this is what you meant to do. There is no reason to loop through the radio buttons, just do this (I tested it and it works for me):
EDIT
For those of you that arrive to this page and are using jQuery 1.7+, jQuery’s new (and recommended) way of binding events to elements is to use the the .on function. Although the above will still work, internally it will be rewritten to use
.onanyway.