I read before that HTML thats used only for JS should not be in the HTML? So how do you store markup to be used for JS added content. eg. Markup for jQuery Dialogs, controls, buttons etc.
Some possibilities I see are:
As a string http://jsfiddle.net/g7g7t/
$(function() {
var dialogHtml = '<div><label>Username</label><input type="text" name="username" /><br /><label>Password</label><input type="password" name="password" /></div>';
var $dialog = $(dialogHtml).dialog({
title: 'Dynamic Dialog'
})
});
That can get messy very quickly
As external file http://jsfiddle.net/3zFeT/ (does not work)
$(function() {
$.get("http://pastebin.com/raw.php?i=pFTCdN81", function(html) {
$(html).dialog({ title: "Dynamic Dialog" });
});
});
What method do you use?