tags:

views:

67

answers:

2

How can I display multiple DIVs with same class and different IDs inline with jQuery? I.e. first I want to check if DIV exists in BODY and then show the next DIV after the current DIV.

A: 
$('div.className').each(function(i,elem){
    elem.style.display = 'inline';
  });

Doesn't matter if the DIV with the class exist, the loop with exit if none matches.

o.k.w
What's wrong with `$('div.className').css('display', 'inline');` ?
J-P
@J-P: Nothing's wrong, in fact that's a better choice :)
o.k.w
+2  A: 

A better version is:

$("div.className").css("display", "inline");
cletus
Yes, I agree this is a better version too. +1
o.k.w