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() {

```

?
Use `delegate` to monitor the parent. Then check if it is last input. Finally do something if so.

<http://jsfiddle.net/n62GN/4/>

```
$('.answerFields').delegate('input[type=text]', 'click', function() {
    if ($(this).is(':last-child')) {
       $(this).val('last');        
    }
});​

```

Live is deprecated so you should get used to delegate instead.