Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript will not combine these together
    text
    copied!<p>I have this js code </p> <pre><code>elem=$(this); var tester_names=""; tester_names=$("#release_tester_tokens").val(); alert(tester_names) if (elem.attr('checked')==true) **tester_names=tester_names+", "+ elem.attr("title");** alert(elem.attr("title")) alert(tester_names) </code></pre> <p>I want to have tester_names=tester_names+", "+ elem.attr("title"); to have the combination of testers_names (a,b,c,d,e) and elem.attr("title") (f) to become (a,b,c,d,e,f) The alerts that I used is for debugging to see what values are stored in the variable.. They all store correctly, but they don't combine together when I call the bolded function... I just want to know why. I am using formtastic textarea instead of the normal textbox... do I have to adjust to that? Or maybe what the tester_names and elem.attr are outputting are of different type?</p> <p>I tried it using this type of code (this is nearly the same with different variable names</p> <pre><code>function updateTextArea() { var allVals = []; $('.taglist :checked').each(function(i) { allVals.push( $(this).val()); }); $('#video0_tags').val(allVals).attr('rows',allVals.length) ; } $(function() { $('.taglist input').click(updateTextArea); updateTextArea(); }); });​ </code></pre> <p>why does this add to checkbox values to the textarea perfectly whenever I check checkboxes when mine just outputs same results before and after using the starred function?</p> <p>(I don't understand why ppl keep voting this down... its seems like a decent question after the first mishap and fix) :S </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload