Ankit Gupta
Ankit Gupta

Reputation: 182

I'm trying to pass javascript variable by a url

I'm trying to pass the java-script variable value by a URL and the URL is for load i-frame here my code

var child_id = 4;

$(newelement).html('<iframe id="becky_bunnyQ1" style="width:92%;height:100%;display:block;position:absolute;border: none;padding-left: 4%;" scrolling="no" src="pages/page20/index.html?id="'+child_id+'></iframe>');

Upvotes: 1

Views: 63

Answers (1)

Bardh Lohaj
Bardh Lohaj

Reputation: 1410

You have a mistake when setting the src attribute. Should be:

$(newelement).html('<iframe id="becky_bunnyQ1" 
style="width:92%;height:100%;display:block;position:absolute;border: 
none;padding-left: 4%;" scrolling="no" 
src="pages/page20/index.html?id='+child_id+'"></iframe>');

Upvotes: 1

Related Questions