Saturday, January 9, 2016

html elements find all css



<input type="submit" name="ctl00$MainContent$btnSearch" value="Search Now" onclick="return validateAge();" id="MainContent_btnSearch" class="btn btn-secondary btn-block">

Find the html element all css in a page.


simply register the function



var getCss = function(el) {
var style = window.getComputedStyle(el);
return Object.keys(style).reduce(function(acc, k) {
var name = style[k],
value = style.getPropertyValue(name);
if (value !== null) {
acc[name] = value;
}
return acc;
}, {});
};



and call the css function 



(MainContent_btnSearch).getCss();

No comments:

Post a Comment