Question: HTML :

```
<form>
<fieldset>
    <ul>    
        <li class="answerFields">
            <input type="text" value="" />
            <input type="text" value="" />
            <input type="text" value="" />
        </li>
    </ul>
</fieldset>
</form>

```

JQUERY :

```
$('.inputfield input').last().live('focus', function() {

    //this is just an example//
    document.write('a');
    ...
});

```

I have a [fiddle](http://jsfiddle.net/rayd360/n62GN/2).

I want to be able to check if the input that the user focuses is the last input in the `<li>`

constraints: I cannot change the HTML. The number of inputs will also be increasing or decreasing.

Answer: 
is this what you're looking for:

```
$('.answerFields input:last-of-type').live('click', function() {

```

?
You can use jQuery next() to see if there is a sibling (the last input will not have one)

<http://jsfiddle.net/7vEy2/>

edit: code

```
$('li > input').live('focus', function() {
    var that = $(this);

    if (that.next().length === 0) {
        alert('last one gained focus!');        
    } else {
        alert('nope');
    }
});

```