Saeed Neamati
Saeed Neamati

Reputation: 35822

jQuery focus() doesn't take the cursor into the input field

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:

enter image description here

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

Answers (1)

Edgar Villegas Alvarado
Edgar Villegas Alvarado

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

Related Questions