Am new to jQuery and wondering if any could advise me on best practise...
I am looking to append a div element to the page, which contains a lot of html and not sure wha
If you want to add the HTML as it is, then just use the jQuery append function. For example:
$('body').append('
');
Change the selector from body to other DOM element/selector according to your requirement.
Or if you already have the div element with ID "test" in the document, then you can set the content using the html() function like below:
$("#test").html('This is the test
\
Hello, just a test
\
Click me\
Click me again');