+ 4
Guys can i use onclick attribute in "input type="text" or input type="number" without using button ?
suppose if i click it will show the value. can you explain me with example.
7 Answers
+ 8
yes you can
<input type="text" onClick="click()"/>
+ 4
One problem is there in my simple coding, i made a simple code after knowing every one's view's but when i click on it both the input type is activated i want only one to be activate and not both. So what is the reason and how do i make it active only one on press it and not two have a look in my Programming.
https://code.sololearn.com/WdinmlaqY13d/?ref=
app
+ 2
As with most tags in HTML, of course! Most event attributes are capable of being used with nearly any HTML tag, and input is no exception.
To do so, you would just add the onclick event attribute somewhere within the opening tag, similar to what you would do with the type attribute.
For example:
<input type = "text" onclick = "func">
<input type = "number" onclick = "func2">
+ 2
to restrict number input (eg 2) use
<input type="tel" min="1" max="2"/>
the onclick you can use..
<input type="text" oninput="aFun()"> when its being input
or
<input type="text" onfocus="aFun()"> when the user just focuses on input field..
or
<input type="text" onblur="aFun()">when the user just leaves the input field
hope this helps...
+ 1
here you go solved
you have used 1 func() 2 for 2 inputs
https://code.sololearn.com/W1L9Jm7fU7ll/?ref=app
+ 1
ŠŠ»ŠøŠ· Š Š°ŃŠ°) Please Russich
0
you should try it before askin , yeah it works ;)