JavaScript Help


I wanted to limit my character limit for a SL360 text answer.  I used the JavaScript below (thanks Google!), but I can't figure out how to make the placeholder text show "Type Text Here."  

Any JavaScript gurus out there who can help me???  Here's the link to the course slide and the code below:


var fields = ["Cause1", "Cause2", "Cause3", "Cause4", "Cause5", "Symptom1", "Symptom2", "Symptom3", "Symptom4", "Symptom5"];

(function setMaxChars(fields) {

    fields.forEach(function (field, field_index) {

         $('[placeholder=' + field + ']').attr('id',field);        











         $('[placeholder=' + field + ']').attr('placeholder', '');



1 Reply
Steve Gannon

Hi Elizabeth,

I would need to see the relevant portion of your .story file to be sure, but I think you should be able to precede the JavaScript code you listed above by assigning an initial value to each of the variables in your "fields" array like this:

var Cause1 = "Type Text Here."

var Cause2 = "Type Text here."

var Cause3 = "Type Text here."

...and so on.