If I have a variable defined in jquery as follows:
var insertString = "<div id='divid'>";
insertString += "<input type='text' name='textbox' value=''>";
insertString += "</div>";
Now, if I want to insert the above variable 'insertString' before some DOM element, how can I do it? I tried Something like below with no success
insertString.insertBefore("body");
insertBeforemethod, only jQuery objects do. You might want to try:$('body').prepend(insertString).<body>which isn't what is asked for (although is quite possibly what is wanted).divbefore thebodyelement anyway?