Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Referencing subquestions in JavaScript (LS7)

More
21 hours 27 minutes ago - 21 hours 26 minutes ago #275298 by squidy
Your LimeSurvey version: 7.7
Own server or LimeSurvey hosting: self-hosted
Survey theme/template: Fruity TwentyThree
==================

In LimeSurvey 3.x it was possible to directly reference a subquestion using JavaScript code similar to this:

$("#answer{SGQ}SQ001").mask("(99) 99999-9999", { placeholder: " " });

How can this be done in version 7 without having to specify the exact ID of the subquestion?
 

Upgrading to LS 7.x
Last edit: 21 hours 26 minutes ago by squidy.

Please Log in to join the conversation.

More
19 hours ago - 18 hours 57 minutes ago #275299 by Joffm
Hi,
I always do it this way using {QID}.
No matter whether with the script of Igor Escobar (which you use as you said some time ago)
$('#question{QID} .question-item:eq(2) input[type="text"]').mask('(000) 000-0000', { placeholder: "(123) 456-7890" });
or the one of Robin Herbots 
$('#question{QID} .question-item:eq(3) input[type="text"]').inputmask({
            'mask': '(999) 999-9999',
            'placeholder': '(123) 456-7890',
            'removeMaskOnSubmit': false,
            'rightAlign': false,
        });



Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 18 hours 57 minutes ago by Joffm.

Please Log in to join the conversation.

Moderators: tpartner, holch

Lime-years ahead

Online-surveys for every purse and purpose