You can achieve that with simple focus()
function of jQuery
jQuery:
$("#button").click(function(){
$("#inputText").focus();
});
Working Example: http://jsfiddle.net/Lrmqr/
Hope this is what you are looking for!
Question
I need to set an anchor tag using eg. <a href="#firstname">Test</a>
to have the same behaviour as a <label for="firstname">Blah</label>
, by putting the cursor inside the input box.
The Form Input has an id="firstname", the link has an href="#firstname".
https://jsfiddle.net/78vmnxdy/
Any ideas how to achieve this?
Solution
You can achieve that with simple focus()
function of jQuery
jQuery:
$("#button").click(function(){
$("#inputText").focus();
});
Working Example: http://jsfiddle.net/Lrmqr/
Hope this is what you are looking for!