Simple jQuery Plugin
https://learn.jquery.com/plugins/basic-plugin-creation/
by klenwell
HTML
<div>not a table</div>
<table id="aTable">
<tr>
<td>a</td>
<td>table</td>
</tr>
</table>
<p>not a table</p>
<table id="anotherTable">
<tr>
<td>another</td>
<td>table</td>
</tr>
</table>
<h5>not a table</h5>
JavaScript
(function ($) {
$.fn.highlightTable = function (options) {
var settings = $.extend({
borderColor: 'blue',
borderStyle: 'solid',
borderWidth: '1px'
}, options);
this.filter("table").each(function () {
var $table = $(this);
$table.css(settings);
//console.debug($table, settings);
});
return this;
};
}(jQuery));
$('table').highlightTable({borderColor: 'red'});
$('table#anotherTable').highlightTable({borderStyle: 'dotted'});