Can someone please correct my code here. It works well in most browsers but I get an error in ie7. I'm sure it's a syntax thing:
<script type="text/javascript">
$(document).ready(function() {
$(".testimonail-label").addClass("-webkit-animation");
$(".banner h2").addClass("-webkit-animation");
$(".banner .test-name").addClass("-webkit-animation");
};
Naftali
147k41 gold badges247 silver badges304 bronze badges
asked May 4, 2011 at 18:23
user127181
7433 gold badges11 silver badges32 bronze badges
-
im not sure what you are trying to do, what are you trying to do?Naftali– Naftali2011年05月04日 18:24:35 +00:00Commented May 4, 2011 at 18:24
-
2And what error do you get? "an error" isn't very illuminating.Quentin– Quentin2011年05月04日 18:25:30 +00:00Commented May 4, 2011 at 18:25
-
why are you adding a class on document.ready? just add those classes in the html markup at design time. If you need to change those classes at runtime, on the client, in response to client-side events, then you use JQuery or JavaScript.Cos Callis– Cos Callis2011年05月04日 18:28:37 +00:00Commented May 4, 2011 at 18:28
-
As you have a syntax error, I'm pretty sure id does not work in most browsers.Felix Kling– Felix Kling2011年05月04日 18:37:35 +00:00Commented May 4, 2011 at 18:37
2 Answers 2
You forgot a ')'
<script type="text/javascript">
$(document).ready(function() {
$(".testimonail-label").addClass("-webkit-animation");
$(".banner h2").addClass("-webkit-animation");
$(".banner .test-name").addClass("-webkit-animation");
});
answered May 4, 2011 at 18:26
Pieter Jongsma
3,3733 gold badges30 silver badges30 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
On the last line you forgot to close out the call to ready:
};
should be
});
answered May 4, 2011 at 18:26
Jacob Relkin
164k34 gold badges352 silver badges321 bronze badges
Comments
lang-js