+ 4
[SOLVED] How can I move cursor?
I'd like to make the checkbox interactive so when someone check it, the cursor jumps into the input box. Thanks for the answers. https://code.sololearn.com/WRc9VLM9oQNg
18 odpowiedzi
+ 15
<input type="checkbox" name="checkbox" onclick="if(this.checked) text.focus();" />
This sets the cursor on the text input
+ 3
And what should happen when the checkbox is unchecked?
+ 3
Tsunugi
Set focus on input if checkbox is checked
+ 3
You're welcome Tsunugi,
BTW I can't reply DMs, so just post it here if you have another query ...
+ 3
How many pairs of checkbox & text though? this will require use of Javascript in any ways ...
+ 2
Ipang nothing actually. I want making it an "other option" in a list and I'd like the cursor would jump to the text box so people can write what is their "other" opinion.
+ 2
Ipang thank you! I'll go and try out. I had a bit hard time with focus
+ 2
Ipang thank you so much! This worked instantly just like I wanted! Thanks again 👍👍👍
+ 2
Solution: <input type="checkbox" name="checkbox" onclick="if(this.checked){ document.getElementById('textbox ID').focus();}/>
if you have more than one textboxes.
+ 2
Tsunugi 👍
+ 1
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ thanks! I give it a try. Still newbie here~
+ 1
Ipang thanks again... How do you define the text.focus if you have more than one text box?
0
Ipang There's two text boxes and a textarea(if that's matter..)
0
Heyy
0
satyam awasthi
Not a right place to say hi hello
0
I know right.
- 1
Click the right button.
- 4
Move your mouse?