0

In particular, method .append(html). How I can add big html code in append, for example:

$("#results").append('<div class="some class"> ...a lot of html code... </div>')
Petr Vasilev
  • 150
  • 14

1 Answers1

1

You could store it in a html file on your server such as 'template.html' and load it in:

$( "#results" ).load( "/template.html" );

That will work if the html is static, but that begs the question, why can't you just show and hide a div on your page that contains the html.

But I'm guessing you have a lot more jQuery inserting values in to the html before you append it to #results, if so maybe you could use something like https://github.com/janl/mustache.js

Hope this helps.

dru_ward
  • 71
  • 4