Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript encriment +1

<span id="counter">0</span>
<pre id="my-pre">test</pre>

<script>
    var counter = 0,
        counterSpan = document.getElementById('counter');

    //add the click listener using addEventListener, this is preferred over inline handlers
    document.getElementById('my-pre').addEventListener('click', function () {
        counterSpan.innerHTML = ++counter;
    });
</script>
Comment

PREVIOUS NEXT
Code Example
Javascript :: export from json 
Javascript :: mongo db get child result with array of parent ids 
Javascript :: using parseint in javascript 
Javascript :: echarts js 
Javascript :: iterate over element parent jquery 
Javascript :: input json decode 
Javascript :: online convert javascript to typescript 
Javascript :: javasrccipt loop array 
Javascript :: short-circuit evaluation , use of || operator 
Javascript :: how to have two entry files in webpack 
Javascript :: Simple Cryptocurrency Blockchain Using JavaScript 
Javascript :: how to get content disposition from header jquery 
Javascript :: ngx chart how to use in angular 
Javascript :: Fibonacci numbers for n terms 
Javascript :: react antd modal with quill 
Javascript :: Viewing Your React App On Another Device 
Javascript :: call the httpclient.get method called 
Javascript :: How to Solve the Parking Lot Challenge in JavaScript 
Javascript :: JavaScript HTMLCollection Object 
Javascript :: get element position react 
Javascript :: Backbone View Event 
Javascript :: top of stack javascript 
Javascript :: climbing stairs 
Javascript :: Solution-4-C--solution options for reverse bits algorithm js 
Javascript :: hide and show button react js 
Javascript :: regexp object 
Javascript :: change string to int javascript 
Javascript :: match all characters regex 
Javascript :: getmonth javascript 
Javascript :: how to convert string to reverse title case in javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =