dom - Easy way to extract several nodes together in jQuery? -


the xml (only 1 datecreated node in document):

 <datecreated>   <year>2011</year>   <month>07</month>   <day>11</day>  </datecreated> 

the result need this:

2011-07-11 

i think need @ least 3 selectors datecreated year, datecreated month , datecreated day, looks quite clumsy.. wondering if there's one-liner or easier way task this. have ideas this? thanks!

you try:

[].join.call(   $.map($('datecreated').children(), function(){      return $(this).text();   }).toarray(),   '-' ); 

Comments

Popular posts from this blog

android - Inheriting from Theme.AppCompat* -

broadcastreceiver - android BOOT_COMPLETED not received if not activity intent-filter -

basic authentication with http post params android -