0

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);
}​

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.