Jump to content

How can I get all classes length with loop


Alon

Recommended Posts

Sorry but there is no option try it yourself and then I wrote on my code play app this is not working,that code I m trying is like this but is wrong please make correct this ,

<p class="post"></p>

<p class="post"></p>

<p id="demo"></p>

<Script>

var  x = 

document.getElementByClassName("post");

document.getElementById("demo").innerHTML=x.length;

</script>

I can get length of classes names with this cod but I can't use loop in this code please do  complete this code with loop 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...