- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Multiple numerical input and default value change with onclick?
- kraycarey
- Topic Author
- Offline
- New Member
Less
More
7 years 5 months ago #143192
by kraycarey
Multiple numerical input and default value change with onclick? was created by kraycarey
I am looking for a little help. I am using the latest version of LimeSurvey - version 2.5+. I have a "Multiple numerical input" question for which I have assigned a default value of 0. To make the end user experience better, I'd like to also include within the below <input *> the parameter of onclick="this.value='' " ... this will remove the need to delete the zero prior to entering a value within the field.
<input class="text form-control numeric em_sq_validation good" name="899495X11X223SQ005" id="answer899495X11X223SQ005" value="0" onkeyup="fixnum_checkconditions(this.value, this.name, this.type, 'onchange',1)" title="Only numbers may be entered in this field." maxlength="25" type="text">
Thanks in advance!
kcarey
<input class="text form-control numeric em_sq_validation good" name="899495X11X223SQ005" id="answer899495X11X223SQ005" value="0" onkeyup="fixnum_checkconditions(this.value, this.name, this.type, 'onchange',1)" title="Only numbers may be entered in this field." maxlength="25" type="text">
Thanks in advance!
kcarey
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3691
7 years 5 months ago #143209
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Multiple numerical input and default value change with onclick?
Set up your survey to use JavaScript
and place the following script in the source of the question:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#question{QID} input.text').focus(function() { if ($(this).val() == 0) { $(this).val(''); } }).blur(function() { if ($(this).val() == '') { $(this).val(0); } }); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- kraycarey
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
7 years 5 months ago #143254
by kraycarey
Replied by kraycarey on topic Multiple numerical input and default value change with onclick?
Thanks for your help!
The topic has been locked.