Reputation: 10161
<script type="text/javascript">
$(function(){
for(var i=0;i<7; i++){
var guy_html = '<div class="aname"><input type="text" class="chatter_input autofriend" name="guy'+String(i) + '" /></div>';
$("div#guy_boxes").append(guy_html);
}
});
</script>
<div id="guy_boxes"></div>
I just want 7 input boxes created and put into the div.
Uncaught Syntax error, unrecognized expression: #
Upvotes: 0
Views: 122
Reputation: 32598
Syntax error, unrecognized expression
is an error that gets thrown by Sizzle (jQuery's selection engine) when you have a poorly constructed selector. Getting it to trip over a #
can happen if it comes at the end of your selector:
$("div#").append(guy_html);
However, your code looks okay. You may want to check other sections of javascript.
Upvotes: 1
Reputation: 982
Maybe you did this in another part of the code
#("selector")
instead of
$("selector")
That would throw the error you described.
Upvotes: 1
Reputation: 50976
It isn't this part of code, because it's working fine here. You should search in different snippets of your code
Upvotes: 0
Reputation: 1754
just ran this through jsfiddle and it works fine and without errors :) http://jsfiddle.net/vM4qU/
Upvotes: 1