Search code examples
javascripthtmlfacebookfbjs

how to pass as parameter to JS function from HTML large chunk of HTML code?


I want to pass as argument a large (maybe 2-3 paragraphs of html formatted code) chunk of HTML code to a Javascript function call from HTML. The problem is, the formatted HTML keeps appearing in the page itself, which shouldnt be the case ! I am assuming theres some problem with single/double quotes !

And, I am working on Facebook tab page.

Can anyone please help me ?

Thanks.

- ahsan


Solution

  • One way is to have a hidden div (something with display:none), and populate that with your 2-3 paragraphs of html formatted code. Then, you can just pass the innerHTML of the div into your function. Quotes (of any kind) won't cause a problem in this method.