Reputation: 1024
i want to increase my width from 0 to a 100.
I've tried this:
<script type="text/javascript">
$(document).ready(function(){
$("#underline").animate({width: '250px'});
};
</script>
To make it increase it's width but it won't work. I've also done some research too see if it's possible with css, but i keep ending up with tutorials on hover effects.
I would really appreciate if someone could help me with the problem.
Upvotes: 0
Views: 183
Reputation: 10975
Syntax error: Closing bracket missing for document.ready
JS:
$(document).ready(function(){
$("#underline").animate({width: '250px'});
});
http://codepen.io/nagasai/pen/rLqqZE
Upvotes: 2
Reputation: 36541
Your script looks good. Just that, I think you are missing a parenthesis there which is breaking your code. :)
<script type="text/javascript">
$(document).ready(function(){
$("#underline").animate({width: '250px'});
});
//^------- here
</script>
Upvotes: 2
Reputation: 821
You want this:
$(document).ready(function(){
$("#underline").css('width', '250px');
});
Working fiddle here:
https://jsfiddle.net/hbtv3bkn/
Upvotes: 1