I have a series of input
elements each with a few
I like to have if where I can click
on any of the
$('div').click(function() {
$(this).find('input[type="text"]').focus();
});
LIVE DEMO
I don't see a reason why you need JS
to do this when such feature is already provided in HTML
.
<label for="YOURID">The clickable region<label>
<input id="YOURID" type="text" />
Try this :
<input id="myInput" />
<div onclick="document.getElementById('myInput').focus(); return false;"></div>
USING HTML ("for") :
HTML provides this functionality. Using "for" "id" you can easily achieve it.
<label for="idname">Click Here to Reach Input<label> <input id="idname" type="text">
$(".classname").click(function(){
$("input").focus(); })
Try this with jquery:
$('#yourdiv').click(function() {
$('#yourfield').focus();
});