Perad Posted August 17, 2009 Share Posted August 17, 2009 Hey, I am having a bit of trouble with the code below. It works in Firefox but not in Safari / IE. If I alert the class it works fine. However, somewhere in assigning a variable I am getting an error. Any ideas? $('tr').click ( function () { // get this class name alert($(this).attr('class')); var class = $(this).attr('class'); // Error is on this line. $.post("http://localhost/example/ajax/read", {id: class}, function() { }); // now toggle the tr element matching this class if there is one $('.content-' + class).toggle(); $('.'+class + ' td').css('font-weight', 'normal'); }); Quote Link to comment Share on other sites More sharing options...
gevans Posted August 17, 2009 Share Posted August 17, 2009 class is a reserved word in javascript, that might be your problem. Try changing 'var class' to 'var myClass' or something similar (don't forget to change every instance). Quote Link to comment Share on other sites More sharing options...
Perad Posted August 17, 2009 Author Share Posted August 17, 2009 Ah ofcourse, thats perfect. Thanks for the help. Quote Link to comment Share on other sites More sharing options...
gevans Posted August 17, 2009 Share Posted August 17, 2009 No worries, if it's sorted hit solved Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.