I have a text form field. It can be cloned/duplicated. It generates name tag like user[name][1][1],user[name][2][1],user[name][3][1] etc…
I want to append a link next to that text fields using jquery. I tried like this..
<script type="text/javascript">
$(function(){
$('<a href="#">Example link</a>').insertAfter('input[name="user\[name\]\[\]\[\]"]')
});
</script>
But its not working. Can anyone help me?. Thanks
Per the jQuery selector docs, special characters need to be escaped with double backslash. For all of the elements at once you can use the
startsWithselector and do:DEMO: http://jsfiddle.net/dpJZE/2/
API selector docs: http://api.jquery.com/category/selectors/
Read top paragraph regarding escaping