Failed to set href inside jQuery click event
Hi I am trying to set the href using JQuery inside the RadioButtonList click event but it doesn't work. If I take the same code for the document.ready event it works fine, but not on the click event. Please advice.
$(document).ready(function() {
url = "Results.aspx?latitude=" +latitude + "&Longitude=" + longitude;
$("a[href='http://www.google.com/']").attr("href", url); // this works..
}
$('.rbl input').click(function() {
id = $(this).parent().children("input").val();
url = "Results.aspx?latitude=" + latitude + "&Longitude=" + longitude + "&ServiceCenterProductTypeId=" + id;
//alert(url);
$("a[href='http://www.google.com/']").attr("href", url); //this doesnt work....
});
});
+2
a source to share