Quantcast
Channel: Topics in Category: Can I do this with LimeSurvey? - LimeSurvey forums
Viewing all articles
Browse latest Browse all 17529

Answers: Use Placeholder instead of Default - by: msr_lance

$
0
0
Here's a revised version which uses jQuery's attributeStartsWith selector to generically find all elements with 'id' starting with "answer". Now we handle input, text area, etc.

var specialPrefix = "***";
 
$('[id^="answer"]').each(function() {
    var value = $(this).attr('value');
    if (value.lastIndexOf(specialPrefix, 0) == 0){
         $(this)
         .attr('value', '')
         .attr('placeholder', value.substring(specialPrefix.length));
    }
});

Viewing all articles
Browse latest Browse all 17529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>