Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Adding A forEach Function To An HTMLCollection JavaScript

<script>
function add()
{ 
const ele = document.getElementsByClassName("myclass");
each= []['forEach'];
HTMLCollection.prototype.forEach = each;
ele.forEach(show);
	 }
function show(q)
	 {
		 console.log(q);
		
	 }
      </script>
  </head>
  <body>
<button id="btn" onclick="add()">Press </button>
<div class="myclass" id="a">aaaa</div>
<div class="q" id="b">bbbb</div> 
</body>
</html>
Comment

PREVIOUS NEXT
Code Example
Javascript :: mean stack tutorial 
Javascript :: extract string from text file javascript 
Javascript :: obfuscation js 
Javascript :: angular injectiontoken 
Javascript :: redux saga use navigation 
Javascript :: super method in js 
Javascript :: how to upload image in react js 
Javascript :: js promises 
Javascript :: selected dropdown value 
Javascript :: sort numbers in array in js 
Javascript :: service worker registration 
Javascript :: how to run node js with proxy 
Javascript :: date to string format javascript 
Javascript :: how to make an array of a value from 1 to the number 
Javascript :: convert div to image and download jquery 
Javascript :: hashing passwords with bcrypt 
Javascript :: set property js 
Javascript :: vuejs delay watch 
Javascript :: props comment 
Javascript :: date range query knex 
Javascript :: json to csv javascript 
Javascript :: === javascript 
Javascript :: get data from excel using vue js 
Javascript :: javascript print to console 
Javascript :: mongoose rename collection 
Javascript :: javascript syntax 
Javascript :: export table data to excel using javascript or jquery 
Javascript :: window.location.search javascript 
Javascript :: react: create form change state on input 
Javascript :: infinite loop in javascript 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =