concatenate javascript jquery strings

var index = $(".root").index(this);

var top = 20 * (index + 1);
$("#resultsSchoolListDiv").find(".dropdownSchoolList").eq(index).css("top" + "," + "\"" + top + "px\"");
//$("#resultsSchoolListDiv").find(".dropdownSchoolList").eq(index).css("top",  "60px");

Open in new window

I need to set the css top property dynamically - I'm trying to achieve what is in the last line dynamically. How do I concatenate the string
Who is Participating?
Albert Van HalenAnalyst developerCommented:
Just use this
$("#resultsSchoolListDiv").find(".dropdownSchoolList").eq(index).css('top', top);

Open in new window

sanagarwlAuthor Commented:
Never mind - solved it using following syntax

 $("#resultsSchoolListDiv").find(".dropdownSchoolList").eq(index).css('top', function (value) {
                return top ;
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.