Reputation: 2367
I have an input inside a div element (id = "edit). I was wondering how, onclick of the div area, I could activate the cursor in the input field.
Upvotes: 0
Views: 902
Reputation: 1
use .attr()
to add and removeAttr()
to remove attribute "disabled" for the text box on the event click on the div.
Upvotes: 0
Reputation: 6085
use .focus()
function like this:
$('#yourDiv').click(function() {
$('#yourInput').focus();
});
Upvotes: 0
Reputation: 114347
$('#edit').click(function() {
$(this).find('input').focus()
})
Upvotes: 1
Reputation: 7525
You could use a <label for="edit">
element. That would focus the <input>
element when clicked.
Upvotes: 3