This is not the best solution, but works as you wanted: $(function(){ $("#vetotable td").not(".lalign") .hover( function() { $(this).addClass("hovertd");}, function() {$(this).removeClass("hovertd"); } ) .click(function(e) { $("[EMAIL PROTECTED]",this).trigger("click", [""]); });
$("#vetotable td input").click( function(e, data) { if (typeof data == "undefined") this.checked = !this.checked; }); }); I've tried different approach but I couldn't unbind the default checkbox behaviour, every time I clicked over the checkbox it fired the TD click function too. -- Gus On Apr 4, 11:59 am, Michael Price <[EMAIL PROTECTED]> wrote: > Hi all, > Thanks for your help with my previous problem (input blanking on click, > defaulting on blur if blank), worked a treat. > > Now for a new one! Consider the following source: > > <table id="vetotable"> > <tr> > <td class="lalign">Name</td> > <td><input type="checkbox" name="x" value="y" /></td> > </tr> > </table> > > And the following JS: > $("#vetotable td").not(".lalign").hover(function() { > $(this).addClass("hovertd");},function() { > > $(this).removeClass("hovertd");}).click(function() { > > $("input",this).attr("checked",!$("input",this).attr("checked")); > > }); > > The purpose of the above is to highlight the cell when the mouse passes > into it, remove the highlight as the mouse leaves, and if the CELL is > clicked, toggle the checkbox inside it. > > This works fine, HOWEVER if I click the checkbox directly, it first > checks, then unchecks itself giving no visible change to the end user. > I'm assuming this is because a click on the checkbox causes the check, > but then a click inside the table cell is detected, forcing the same > action and thus unchecking again. > > How do I prevent this from happening so I can click the cell OR the > checkbox and achieve the desired result? Thanks :) > > Regards, > Michael Price