Welcome to the LimeSurvey Community Forum

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

Using Javascript to replace text on #tokenmessage

  • stemate1988
  • stemate1988's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 8 months ago #122643 by stemate1988
Morning,

I have a bit of jquery which i want to use to replace some text in the #tokenmessage.
I want 'Please contact' to be replaced.

$("#tokenmessage p").text($("#tokenmessage p").text().replace("Please contact", "It looks as though you’ve recently completed the survey and provided your feedback. Unfortunately, we’re only able to accept one survey per applicant"));

Is this possible and where would the code have to sit?
The topic has been locked.
  • stemate1988
  • stemate1988's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 8 months ago #122649 by stemate1988
Replied by stemate1988 on topic Using Javascript to replace text on #tokenmessage
re-raised in correct area #122647

stemate1988 wrote: Morning,

I have a bit of jquery which i want to use to replace some text in the #tokenmessage.
I want 'Please contact' to be replaced.

$("#tokenmessage p").text($("#tokenmessage p").text().replace("Please contact", "It looks as though you’ve recently completed the survey and provided your feedback. Unfortunately, we’re only able to accept one survey per applicant"));

Is this possible and where would the code have to sit?

The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 8 months ago - 8 years 8 months ago #122667 by DenisChenu
Replied by DenisChenu on topic Using Javascript to replace text on #tokenmessage
[strike]Not sure, can you test with p:first ?[/strike]

[strike]There are only one p in tkenmessage ?[/strike]

Hi,

Did you try to put :
Code:
$(function() {
if($("#tokenmessage p").length){
$("#tokenmessage p").text($("#tokenmessage p").text().replace("Please contact", "It looks as though you’ve recently completed the survey and provided your feedback. Unfortunately, we’re only able to accept one survey per applicant"));
}
});
In template.js ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 8 years 8 months ago by DenisChenu. Reason: fix ....
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 8 months ago #122672 by DenisChenu
Replied by DenisChenu on topic Using Javascript to replace text on #tokenmessage

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose