unable to set href inside click event of Jquery

Posted by akshatrautela on Stack Overflow See other posts from Stack Overflow or by akshatrautela
Published on 2010-05-12T23:46:15Z Indexed on 2010/05/12 23:54 UTC
Read the original article Hit count: 170

Filed under:
|
|

Hi I am trying to set href using Jquery inside click event of RadioButtonList but that doesnt work If I take the same code to document.ready event it works fine but not in 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....

        });
    });

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ASP.NET