Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Assign A New Method To Every Node

<head>
	  <script>
 function add()
		  {
			  Node.prototype.d = function(){
			  console.log(this.textContent)	
};
let a =			  document.getElementById("a");
let b =			  document.getElementById("b");
a.d();
b.d();
}
      </script>  
  </head>
  <body>
<button id="btn" onclick="add()">Press </button>
<div id="a">aaaa</div>
<div id="b">bbbb</div> 
</body>
Comment

PREVIOUS NEXT
Code Example
Javascript :: js if animation infinity end 
Javascript :: javascript detect if browser is not google chrome 
Javascript :: check if value is a string javascript 
Javascript :: event.target javascript 
Javascript :: what is so called abstractions in javascript 
Javascript :: how to call ajax javascript 
Javascript :: how to declare a variable js 
Javascript :: fibonacci sequence array 
Javascript :: javascript break with while Loop 
Javascript :: map method 
Javascript :: js date 
Javascript :: node js mongodb update nested object 
Javascript :: define function javascript 
Javascript :: js string 
Javascript :: event.target 
Javascript :: Lazy Loading 
Javascript :: export default class react 
Javascript :: gitea 
Javascript :: react-hook-form-input npm 
Javascript :: for loop in react native 
Javascript :: js a function that takes in multiple arguments. 
Javascript :: data table buttons 
Javascript :: object methods 
Javascript :: javascript callbacks 
Javascript :: how to validate date in react 
Javascript :: sort array with negative numbers 
Javascript :: regex javascript matching first letter to last 
Javascript :: Hint:“javascript sleep 1 second” is a pretty common code problem that people search ;-) 
Javascript :: add a string to list jquery 
Javascript :: jquery direct window print pdf 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =