Link to home
Start Free TrialLog in
Avatar of peps03
peps03

asked on

Parse error in simple jquery code

Hi,

As you can see below in the code, i get a parse error.

The script works in chrome not in safari. (which i think is strange because they both use webkit)

What is wrong with the code and how can i fix it?

Thanks!
<script>
function class() {  
        
contact.php:31SyntaxError: Parse error

if ($('#55').hasClass('buttonactive')) 
{$('#55').removeClass('buttonactive').addClass('button');}
else 
{$('#55').removeClass('button').addClass('buttonactive');}
}
</script>

Open in new window

Avatar of leakim971
leakim971
Flag of Guadeloupe image

try to use a valid ID
currently you're using only numbers

Check Attribute Values here for example to know the rules :
http://www.w3schools.com/tags/att_standard_id.asp
Avatar of peps03
peps03

ASKER

thanks.

i changed it to, but still get the error:
 
<script>
function class() {          
contact.php:31SyntaxError: Parse error

if ($('#a55').hasClass('buttonactive')) 
{$('#a55').removeClass('buttonactive').addClass('button');}
else 
{$('#a55').removeClass('button').addClass('buttonactive');}
}
</script>

Open in new window

use an other function name else, post the php script
ASKER CERTIFIED SOLUTION
Avatar of peps03
peps03

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of peps03

ASKER

se last post