Howdy_McGee
Howdy_McGee

Reputation: 10645

Jquery - Edit Object Parameters

I have an Object and I'm trying to use jquery to quickly change the parameter values, but the parameters keep coming back null. code brings back the list of parameters but I can't seem to change anything. Even if I put it at it's base of parameters to change everything - it still comes back as null.

Other than that it works, but if u look closely you will see some api error messages in black at the top left. I added a pastebin so you can see what I'm doing.

http://jsfiddle.net/f4qMe/

and below is the javascript I'm running to try and change the objects parameters. The object is called (id) twitchTV.

function test(){             
    var data = "http://www.twitch.tv/widgets/live_embed_player.swf?channel=day9tv";
    var src = "hostname=www.twitch.tv&auto_play=true&start_volume=25&channel=day9tv";

    var code = $("#twitchTV").html();
    var newcode = $("param", code).attr("value", src).html();
    $("#twitchTV").html(newcode);
    $("#twitchTV").attr("data", data);
}​

Upvotes: 0

Views: 755

Answers (1)

elclanrs
elclanrs

Reputation: 94101

Your problem is probably here:

var code = $("#twitchTV").html();
var newcode = $("param", code).attr("value", src).html();

html() returns a string so code is a string and you're using it as context in newcode which expects an DOM element or jquery object instead.

Upvotes: 2

Related Questions