Skip to content

Instantly share code, notes, and snippets.

@sranso
Created August 1, 2014 14:39
Show Gist options
  • Save sranso/0ae99eeaae8c287af735 to your computer and use it in GitHub Desktop.
Save sranso/0ae99eeaae8c287af735 to your computer and use it in GitHub Desktop.

#append in jquery just learned that you can only append a jquery array, not a single object in that array.

for example $('#myh1').append('<h2>hi, h1. i am now your child.</h2>'); works. this, on the other hand, does not: $('#myh1')[0].append('<h2>hi, h1. i am not your child. i will make jquery unhappy.</h2>'); it will return TypeError: undefined is not a function because append is not a funciton on an individual item. must be in array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment