I’m trying to find the syntax to determine whether a div has a child div containing the data-role attribute set to header. I’ve tried these things with no luck:
$('div[data-role*="page"]').each(function(i) {
if($(this).children('div').attr('data-role')=='header';) {
alert("has header");
}
});
$('div[data-role*="page"]').each(function(i) {
if($(this).children('div[data-role*="header"]').length!=0;) {
alert("has header");
}
});
In this example you have a trailing
;after!=0;Example on jsfiddle.