Skip to content

Instantly share code, notes, and snippets.

@henrahmagix
Created January 29, 2013 09:23
Show Gist options
  • Save henrahmagix/4662962 to your computer and use it in GitHub Desktop.
Save henrahmagix/4662962 to your computer and use it in GitHub Desktop.
Verbose method to build HTML using jQuery. No more insanely long strings!
// Found at http://usejquery.com/posts/the-jquery-cross-domain-ajax-guide.
// Modified to remove undefined variables. Docs at http://api.jquery.com/jQuery/#jQuery2
jQuery('<li/>', { //build an li element
html: jQuery('<a/>', { //with an A element inside it
href: 'http://henrahmagix.github.com', //set the href for the link
text: 'Henrahmagix On GitHub' //and the text
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment