jonniejoejonson Posted August 3, 2010 Share Posted August 3, 2010 var testVar="steve"; that works fine... but var testVar='<div class="test"><img src="test.jpg"></div>'; Is there something i can do to allow me to use html tags in a variable... regards J. Link to comment https://forums.phpfreaks.com/topic/209643-store-html-in-a-variable-in-javascript/ Share on other sites More sharing options...
Alt_F4 Posted August 3, 2010 Share Posted August 3, 2010 You CAN store html tags in a javascript variable. What is it you a re trying to do? and what are you having problems with? Link to comment https://forums.phpfreaks.com/topic/209643-store-html-in-a-variable-in-javascript/#findComment-1094479 Share on other sites More sharing options...
jonniejoejonson Posted August 3, 2010 Author Share Posted August 3, 2010 Thanks for the response, but i think i have solved it... I was trying to loop through a php array and convert it into javascript array. When i was looping through the php array, if it had quotes in it, then it would break, therefore by using php addslashes function it appears to solve the problem. Link to comment https://forums.phpfreaks.com/topic/209643-store-html-in-a-variable-in-javascript/#findComment-1094498 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.