html - JQuery showing and hiding p elements one after the other -


i trying loop through multiple p elements using jquery show , hide them can't work. i've tried loop. current shows , hides p elements , show , hide them 1 after other. here's code:

html

<p hidden="" class="tweet-1">"lorem ipsum"</p> <p hidden="" class="tweet-2">"lorem ipsum"</p> <p hidden="" class="tweet-3">"lorem ipsum"</p> 

etc

jquery

var i=0     $("p").each(function() {      $(".tweet-" + i).show().hide();     i+=1      }); 

this works me:

$("[class^=tweet-]").each(function(index){      $(this).delay(500*index).fadein();   }); 

but need change "hidden" attribute in paragraph css display none.

<p class="tweet-1" style="display:none">"lorem ipsum 1"</p> <p class="tweet-2" style="display:none">"lorem ipsum 2"</p> <p class="tweet-3" style="display:none">"lorem ipsum 3"</p> 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -