I have a HTML table and the following script to add a specific class
to the cells, depending on their content.
Now, I would like to count only the items with class = active
and trigger a modal (autoOpen: true
) with the number of those items.
Any suggestions?
<script>
$('td').each(function() {
var $this = $(this)
if ($this.text().match(new RegExp(/^[0-9][A-Z]/)) !== null ) {
$this.addClass('active');
}
if ($this.text().match(new RegExp(/^c[0-9]/)) !== null ) {
$this.addClass('none');
}
});
</script>