javascript - How to add "oninput" to html form tag, targeting the tag by id instead of editing the form tag itself -


i want use code found online http://jsfiddle.net/2ghqx/ in contact form in order show range slider values in real time, however, form created using wordpress plugin, can't add javascript <form> tag. plugin allow me add id's , classes form tag though (plugin: contactform7).

is there way add oninput="amount.value=rangeinput.value" <form> tag, without editing form tag maybe targeting form using id or class?

i know very little javascript, appreciate help.

so instead of

<form oninput="amount.value=rangeinput.value"> 

i want form tag this:

<form id="myform"> 

and add oninput tag targeting form id using javascript

you can use document.getelementbyid() method access form:

var myform = document.getelementbyid('my-form-id'); myform.addeventlistener('input 

var theform = document.getelementbyid('theform');  theform.addeventlistener('input', function(){    alert('hi');    });
<form id="theform">        <input />      </form>


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -