specked
specked

Reputation: 145

jQuery dynamically change onclick location.href

This works in firefox but doesn't do anything in IE:

$("#_results").autocomplete({
    source: data,
    minLength: 0,
    select: function(event, ui) {
        $("#log").empty();
        log(ui.item.lname + ", " + ui.item.fname + " " + ui.item.sso);
        log("Currently in " + ui.item.currentRotation + " rotation");
        log("Graduated from: " + ui.item.college);
        log("More details can be viewed by clicking here");
        $("#log").attr("onclick", "location.href=\'" + ui.item.dataformEntry + "\'\;");
    }

Specifically $("#log").attr("onclick", "location.href=\'" + ui.item.dataformEntry + "\'\;");

Is there another way to do this?

Upvotes: 0

Views: 9995

Answers (2)

fcalderan
fcalderan

Reputation:

have you already tried with

$("#log").bind("click", function() { 
    location.href = ui.item.dataformEntry 
});

Upvotes: 1

Chinmayee G
Chinmayee G

Reputation: 8117

try this

$("#log").click(function(){
     location.href= ui.item.dataformEntry;
});

Upvotes: 3

Related Questions