Question: Why the link on response page (test.html) cannot call jquery on the main page? eventhough both links have same class, please help what do I have to do to make it works.

main page :

```
<script type="text/javascript">
      $(document).ready(function () {
        $(".comment_link").click(function () {
                $.ajax({
                    url: "test.html",
                    success: function (cont) {
                        if (cont) {
                            $("#view" ).append(cont);
                        }
                    }
                });
                return false;
    });
    });
    </script>

    <div id="view"></div>
    <a href="#" class="comment_link">add comment</a>

```

file content of test.html :

```
    Helloo
    <a href="#" class="comment_link">Test</a>

```

Answer: 
A startswith selector is possible, or use a common classname.

```
$("[id^='thistext']").keyup(function(e){
      var keyed = $(this).val();
      $("#target").html(keyed);
 });

```

While using startwith selector provide a parent container as context for safety i.e `$("[id^='thistext']", 'container')`

Also do remember that this will be slower than native id or class selector as this is an attribute selector.

**[attribute-starts-with-selector](http://api.jquery.com/attribute-starts-with-selector/)**

So providing a common classname to all of those textboxes and selecting then using the classSelector would be ideal i believe.
No, but this is possible:

```
$('#thistext0, #thistext1, #thistext2, #thistext3').keyup(function(e){
      var keyed = $(this).val();
      $("#target").html(keyed);
});

```

Of course, the selector string can be created in a loop. Or just add a class to your input fields, and select by class.