Alon Posted July 18, 2019 Share Posted July 18, 2019 Hi I m new and I need help som,how can I get all classes length with loop Link to comment Share on other sites More sharing options...
dsonesuk Posted July 18, 2019 Share Posted July 18, 2019 You mean like this? https://www.w3schools.com/code/tryit.asp?filename=G650H6QWET2L Link to comment Share on other sites More sharing options...
Alon Posted July 19, 2019 Author Share Posted July 19, 2019 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 More sharing options...
Ingolme Posted July 19, 2019 Share Posted July 19, 2019 Why do you need a loop? Is this a homework question? Link to comment Share on other sites More sharing options...
dsonesuk Posted July 19, 2019 Share Posted July 19, 2019 (edited) Option? Don't know what you mean by option? And it's getElementsByClassName not getElementByClassName. Edited July 19, 2019 by dsonesuk Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now