Last Updated: February 25, 2016
·
579
· paradigmshift

jQuery's .children() vs .find()

Writing a dialog pop-up for a mobile app I'm currently developing, I found that I couldn't get the dialog to update with new content even though the functions were being passed the correct argument.

$header = $page.children( ":jqmData(role=header)" ),
$content = $page.children( ":jqmData(role=content)" )

Changing the method to .find() made everything work as it should:

$header = $page.find( "div:jqmData(role='header')" ),
$content = $page.find( "div:jqmData(role='content')" )