?
Solved

array in jquery

Posted on 2008-11-05
3
Medium Priority
?
5,109 Views
Last Modified: 2012-05-05
a jquery function, it works when i call single items like $('list1').fadeIn("100000");.
 but it fails when i use the array. whats the correct syntax to replace single item with array?
function fadee(){
        for(i=0;i<list.length;i++){
                document.getElementById(list[i]).style.display='none';
        }
        $('list[i]').fadeIn("100000"); 
		/*$('list1').fadeIn("100000"); */
		document.getElementById(list[i]).style.display='';
 }

Open in new window

0
Comment
Question by:vidhubala
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 2000 total points
ID: 22888764
try:
$('#' + list[i]).fadeIn("100000");
0
 
LVL 82

Expert Comment

by:hielo
ID: 22888771
NOTE: that statement is outside the for clause, so "i" refers to a non-existent element. perhaps you meant to have it within the for.
0
 

Author Closing Comment

by:vidhubala
ID: 31513639
great. thanks
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses
Course of the Month17 days, 8 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question