if($(".element").attr("style").length>0){
//do some code
}
//example functions
(function ($) {
$.fn.inlineStyle = function (prop) {
var styles = this.attr("style"), value;
styles && styles.split(";").forEach(function (e) {
var style = e.split(":");
if ($.trim(style[0]) === prop) {
value = style[1];
}
});
return value;
};
}(jQuery));
//you can call it with the following code:
var width = $("#someElem").inlineStyle("width");
Just simple snippet for various purposes
Added function in order to check if element has specific style
Added function in order to check if element has specific style
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.