+ 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.

19th Feb 2018, 3:46 AM
🦋FEATHER🦋
🦋FEATHER🦋 - avatar
7 Respostas
+ 8
yes you can <input type="text" onClick="click()"/>
19th Feb 2018, 4:10 AM
Sudarshan Rai
Sudarshan Rai - avatar
+ 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
19th Feb 2018, 10:59 AM
🦋FEATHER🦋
🦋FEATHER🦋 - avatar
+ 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">
19th Feb 2018, 3:50 AM
Faisal
Faisal - avatar
+ 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...
19th Feb 2018, 7:47 AM
_c0d£ Bit£_
_c0d£ Bit£_ - avatar
+ 1
here you go solved you have used 1 func() 2 for 2 inputs https://code.sololearn.com/W1L9Jm7fU7ll/?ref=app
19th Feb 2018, 11:02 AM
Sudarshan Rai
Sudarshan Rai - avatar
+ 1
Плиз Раша) Please Russich
24th Feb 2018, 5:41 PM
ArAnstudio
ArAnstudio - avatar
0
you should try it before askin , yeah it works ;)
19th Feb 2018, 10:43 PM
Ahmed Ayachi
Ahmed Ayachi - avatar