Last active
August 29, 2015 14:13
-
-
Save benjaminfisher/90f593f1280f46e85a88 to your computer and use it in GitHub Desktop.
JS: Test that TD element width matchs declared width (jQuery)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="http://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript" charset="utf-8"></script> | |
<script> | |
$(function(){ | |
$('<p>').html('Width').prependTo('body'); | |
$('tr').each(function(){ | |
$(this).children('td').each(function(i){ | |
var $this = $(this); | |
if(!$this.attr('colspan') && !($this.width() == $this.attr("width"))){ | |
console.log("width:", $this.width(), " attr:", $this.attr("width")); | |
console.log(this); | |
$(this).css("outline", "1px solid red"); | |
} | |
}) | |
}) | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment