jQuery Awesome Insert

Inserting fresh HTML elements into jQuery can be a tough thing. A lot of time you are hand building every element, attribute, and content. It's unnatural. A better way would be to just to write out the HTML you want, then tell jQuery to find an element through it's awesome CSS engine, then toss it in. Sometimes, code speaks louder than words, so here it is:

var NAME = $('TEXT');
$("#DIV").prepend(NAME);

Enjoy.


Comments

The first thing that most Javascript programmers end up doing is adding some code to their program, similar to this: window.onload = function(){ alert("welcome"); } Inside of which is the code that you want to run right when the page is loaded. Problematically, however, the Javascript code isn't run until all images are finished downloading

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <em> <strong> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options