I’m using a Twitter Bootstrap 3 form with (4) Radio form controls. When a user clicks on any of the four radio controls, an <input type="text">
appears. How do I make it, so that the first input, on any radio option select is “autofocus”.
To see code, if you may, please visit: https://von.host/cart.php?a=add&pid=20
It just seems silly to have the user click a radio button, than click again on the input field and type, than click once more on submit button…instead of three clicks, I wish to make it two.
p.s. – i added “autofocus” to all (4) input fields, but it only worked for the first one…of course ^ _ ^
2
Answers
I think, you can this only with a little part of javascript 🙂 for example:
In nutshell, this code pass the focus for the input field, when the radio give it.
Keep the autofocus attribute in the first one and use this jQuery code: