I have following code snippet in jquery.In which,I want to animate each element of array one by one.
<script type="text/javascript">
function AnimateText() {
var myCars = new Array("Saab", "Volvo", "BMW");
myCars.each(function () {
$(this).fadeIn("2000").fadeOut("2000");
});
}
</script>
But I am getting this error Object does not support this method or property
EDIT
Thanks all for the answer.Now I have problem in animating the array element on the screen.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default7.aspx.cs" Inherits="Default7" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
function AnimateText() {
var myCars = new Array("Saab", "Volvo", "BMW");
$.each(myCars, function (key, value) {
$("#myDiv").html(value).fadeIn("2000") ;
});
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="myDiv"></div>
<input type="button" id="btnTest" value="Animate" onclick="AnimateText();" />
</form>
</body>
</html>