Default text in a response that disappears when clicked on

2»

Answers

  • TomG
    TomG Raleigh, NC Wizard ✭✭✭✭✭

    @Fahad,

    The code provided will add a placeholder to all the textarea elements on the page. Change the jQuery selector as needed.

  • Fahad
    Fahad UAE Qubie ✭

    @TomG : Hi Tom, it works with a single text box, however doesn't work with multiple text boxes in the same question

  • TomG
    TomG Raleigh, NC Wizard ✭✭✭✭✭

    @TomG : Hi Tom, it works with a single text box, however doesn't work with multiple text boxes in the same question

    I forgot .attr() only works on the 1st element in the set, use .each():

    jQuery("#"+this.questionId+" .InputText").each(function() {
      jQuery(this).attr("placeholder", "My placeholder text");
    });
    


  • Fahad
    Fahad UAE Qubie ✭

    @TomG

    Thanks :)... will try.

    Another question on the topic of changing logo. I already have existing static template with everything (color, format) in place. However since our logo changed this year someone had put in placed Custom CSS code for the new logo while everything (formatting and color) remains same. I mistakenly removed the Custom CSS code.

    Can you help me how to write the custom CSS code?

  • Fahad
    Fahad UAE Qubie ✭

    @TomG: Sorry for asking so many questions i am very new to Qualtrics.

    I found the below link used in one of the earlier study, what I understand is that the logo is being removed and replaced with background in url. Now if I need to do the same how do I develop the url?

    Please help, appreciate it

    html .Skin #Logo {display: none;}

    #SurveyEngineBody {

      background: url(https://etihad.eu.qualtrics.com/CP/Graphic.php?IM=IM_86xvhpypazMDskl) no-repeat fixed;

     -webkit-background-size: cover;

     -moz-background-size: cover;

     background-size: cover;

    }

  • TomG
    TomG Raleigh, NC Wizard ✭✭✭✭✭

    The url is an image you upload to your Qualtrics library. After you upload it, copy the url into your CSS.

  • John_P
    John_P Massachusetts, USA Qubie ✭

    Getting back to the original question, I have a series of 6 text boxes in a question and I need to add custom placeholder text that is different for each box. I have used the code noted above but it still only places the same set of text in each box. I am not sure how I can tell the script to place a specific text string in a specific text box... Any help is welcome!

    Thanks

  • John_P
    John_P Massachusetts, USA Qubie ✭

    THAT'S IT! Took a sec to realize the ph"x" corresponded to the text in each placeholder field but it works perfectly!

  • mmontenegro
    mmontenegro Canada Qubie ✭

    Hi @TomG I am trying to make a default choice in a constant sum matrix table have a default choice equal to zero and have the 0 disappear when respondents click on the boxes to enter a number. I tried using the code below in addonload but it's not working. The table could also be text matrix if needed. Would you know how I can do this? Thank you in advance!

    jQuery("#"+this.questionId+" .InputText").each(function() {
      jQuery(this).attr("placeholder", "My placeholder text");
    });
    


  • TomG
    TomG Raleigh, NC Wizard ✭✭✭✭✭

    The "0" in a constant sum isn't a placeholder, it is the initial default value. If a field has a value (i.e., is non-blank) the placeholder won't display.

    You don't need a placeholder. I think you want:

    Qualtrics.SurveyEngine.addOnload(function() {
    	jQuery("#"+this.questionId+" .SumInput .InputText").focus(function() {
    		if(this.value == "0") this.value="";
    	});
    });
    
  • mmontenegro
    mmontenegro Canada Qubie ✭

    Right, thanks for pointing out the difference! The code you provided is not making the default choices (0) disappear when you click on the box. Any ideas of something else I can try?

  • TomG
    TomG Raleigh, NC Wizard ✭✭✭✭✭

    The code provided works on a Constant Sum question. For a constant sum matrix change it to:

    Qualtrics.SurveyEngine.addOnload(function() {
    	jQuery("#"+this.questionId+" td:not(.CSTotal) input[type=text]").focus(function() {
    		if(this.value == "0") this.value="";
    	});
    });
    
  • mmontenegro
    mmontenegro Canada Qubie ✭

    Thank you!