jQuery add border to table.
Posted
by Kyle Sevenoaks
on Stack Overflow
See other posts from Stack Overflow
or by Kyle Sevenoaks
Published on 2010-04-28T11:05:36Z
Indexed on
2010/04/28
11:13 UTC
Read the original article
Hit count: 253
Hi, I'm a jQuery noob, I tried this:
<input value="1" type="checkbox" name="mytable" id="checkbox2" style="float:left;"
/>
{literal}
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(function() {
//checkbox
$(".mytable").click(function(){
$(".mytable").toggleClass('mytableborders');
});
});
</script>
{/literal}
<table class="mytable" id="cart">....</table>
But it doesn't work, I want the checkbox to change the class of the table from .mytable
to .mytableborders
.
Thanks :)
© Stack Overflow or respective owner