I want to test if a class exists in the and if it does then execute the script within the statement using javascript/google closure. Problem is my current code returns undefined so I was wondering if anyone could give me some advice?
if ( goog.dom.classes.has('html', 'pe') ) {
var searchCtn = goog.dom.getElementsByClass('search');
var headerWrapper = goog.dom.getElementByClass('header');
goog.dom.append(headerWrapper,searchCtn);
}
‘html’ is not a valid element object. Try passing in document.documentElement or use google to get the element by classname.
or