Reputation: 35822
I know that $('#siteTitle').focus()
takes the focus into the input field which has the id siteTitle
, and I also know that focus()
causes the input to become the current active element of the document, thus retrievable via document.activeElement
.
My problem is that, I can't type anything into titleInput
field in spite of setting focus on it. My input has some formatting already applied on it, and has a default dimmed watermark:
But no cursor is shown inside it, and worse, I can't type in it. As I said, when I use document.activeElement
, input field is returned. Therefore, I'm sure that it has focus.
This is my HTML:
<div class="titleWrapper">
<div class="titleInpWrapper">
<input type="text" name="title" id="titleInput" value="Site Name" tabindex='0' /></div>
<p class="label">
What's your site's name?</p>
<p class='alert titleStep'>
</p>
</div>
Upvotes: 4
Views: 5269
Reputation: 18344
I think another javascript piece of code is interfering with your typing. Check that.
You can use firefox's fireQuery add-on to see if the element has other events binded to it
Upvotes: 3