jquery error NS_ERROR_XPC_BAD_CONVERT_JS: in FF works but not on Chrome
<p>I'm using jquery for adding fields to a form, "repeatable" fields with "add more" button</p>

<p>The code is</p>

<pre><code>       $(".add-attacker-scores").click(function() { 

            count = count + 1;

            $('#atacker_score_items').append('&lt;li&gt;&lt;span class="sort hndle"&gt;&lt;label&gt;team :&lt;input type="text" name="attacker_scores[' + count + '][team]" size="30" value=""/&gt;&lt;/label&gt;&lt;label&gt;flags :&lt;input type="text" name="attacker_scores[' + count + '][flags]" size="10" value=""/&gt;&lt;/label&gt;&lt;label&gt;phone homes :&lt;input type="text" name="attacker_scores[' + count + '][phone]" size="10" value=""/&gt;&lt;/label&gt;&lt;label&gt;Injects :&lt;input type="text" name="attacker_scores[' + count + '][injects]" size="10" value=""/&gt;&lt;/label&gt;&lt;span class="remove"&gt;Remove&lt;/span&gt;&lt;/li&gt;');

            var temp = &lt;? echo implode('',explode("\n",Print_attacker_scores('count') )); ?&gt;;
                temp = temp.replace(/count/g, count);
                $('#atacker_score_items').append(temp);

            return false;
        });
</code></pre>

<p>The code for Print_attacker_scores is</p>

<pre><code>function Print_attacker_scores($cnt, $p = null) {
if ($p === null){
    $a = $b = $c = $d = '';
}else{
    $a = $p['team'];
    $b = $p['flags'];
    $c = $p['phone'];
    $d = $p['injects'];
}
return  &lt;&lt;&lt;HTML
&lt;li&gt;&lt;span class="sort hndle"&gt;&lt;/span&gt;
    &lt;label&gt;team :
    &lt;input type="text" name="attacker_scores[$cnt][team]" size="30" value="$a"/&gt;
    &lt;/label&gt;

    &lt;label&gt;flags :
    &lt;input type="text" name="attacker_scores[$cnt][flags]" size="10" value="$b"/&gt;&lt;/label&gt;

    &lt;label&gt;phone homes :
    &lt;input type="text" name="attacker_scores[$cnt][phone]" size="10" value="$c"/&gt;&lt;/label&gt;

    &lt;label&gt;injects :
    &lt;input type="text" name="attacker_scores[$cnt][injects]" size="10" value="$d"/&gt;&lt;/label&gt;

    &lt;span class="remove"&gt;Remove&lt;/span&gt;
&lt;/li&gt;
HTML
;
}
</code></pre>

<p>In firefox its working but in chrome it doesn't work.</p>

<p>Then i realized that it throws an error: 
NS_ERROR_XPC_BAD_CONVERT_JS: Could not convert JavaScript argument arg 0 [nsIDOMDocumentFragment.appendChild]</p>

<p>Why is happening this?
I've copied the code from around the web but i can fix it because i don't understand this lines:</p>

<pre><code>var temp = &lt;? echo implode('',explode("\n",Print_attacker_scores('count') )); ?&gt;;
                temp = temp.replace(/count/g, count);
</code></pre>

<p>so this is reading the html generated by the Print_scores_function and creating an array with each line.Then generates a string with all the items in the array.
Then replaces the count number¿? i don't understand why it is doing this.
Maybe there's a another way of doing it  more simple?</p>

<p>(/count/g, count) is a regular expression?</p>

<p>What am i doing wrong?</p>
