hi! i only want to know how to get the value of the array in javascript using class?
<div class='view'>1</div>
<div class='view'>2</div>
<div class='view'>3</div>
<div class='view'>4</div>
hi! i only want to know how to get the value of the array in javascript using class?
<div class='view'>1</div>
<div class='view'>2</div>
<div class='view'>3</div>
<div class='view'>4</div>
Try this simple code.
<script type="text/javascript">
<!--
var myArray = new Array();
myArray[0] = "Football";
myArray[1] = "Baseball";
myArray[2] = "Cricket";
document.write(myArray[0] + myArray[1] + myArray[2]);
//-->
</script>
Apply it in your class...
The first problem is that the correct spelling is getElementsByClassName
The second problem is that some browsers do not support it http://www.quirksmode.org/dom/w3c_core.html#fivemethods
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.