Check out the LimeSurvey source code on GitHub!

Hiding items

More
5 years 7 months ago #63854 by cpippsych
Hey

not sure if this is the place to ask.

looking to find out of lime survey can do this:-

1) hide an entire radio or drop down list button question using jquery
2) hide an entire short text question using jquery
3) hide any entire question using jquery (i could recycle the above if anybody has link to relevant names of questions).

Iif any body help I would appreciate.

From with thanks, Phillip

Please Log in to join the conversation.

More
5 years 7 months ago #63859 by DenisChenu
Hello,

To hide question 42 with jquery
<script>
jQuery(document).ready(
$("#question42").hide();
);
</script>

And to hide only the answer part but show the question part. If you use default template.
<script>
jQuery(document).ready(
$("#question42 .answer").hide();
);
</script>

You can use css to, in template.css:
#question42{position:absolute;top:-999em;left:-9999em}
I prefer to use position absolute, sometimes with display:none, you can't manipulate the answers with javascript.

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

More
5 years 7 months ago #63861 by cpippsych
danke muchly!! i also look for a tiny piece code to determine whether a question is hidden or shown? (for us in 'if' statement).

Is that possible?

Phillip

Please Log in to join the conversation.

More
5 years 7 months ago - 5 years 7 months ago #63862 by DenisChenu
I don't understand ?
If a question exist in the page ?
Or if it's hidden by javascript or css ?
Hidden by condition ?

Can you explain your problem exactly : what did you want to do ?

Look at : api.jquery.com/hidden-selector/

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
Last Edit: 5 years 7 months ago by DenisChenu.

Please Log in to join the conversation.

More
5 years 7 months ago #63864 by cpippsych
Apologies, sorry if my intent was not evident. Apologies, again, my fault.

I was looking for java(J)script rather than CSS. I have managed CSS already to hide something.

I am looking for an on.click event to hide a certain (question&answer). As such, the question would already exist on the page, the question would not be affected by CSS, and there would be no rules/condition. It would merely be by javascript in an ondemand way with relation to a click.

Don't worry if you cannot help. You have already been very helpful, and I would not wish you to expend your effort on my minor question!

Phillip

Please Log in to join the conversation.

More
5 years 6 months ago #63873 by DenisChenu
What you can do,

For example, you put in the source code of a question a img block and assign it the onclick:
<img id="activateonclick" src="mypicture.png" />
<script>
jQuery(document).ready(
$('#activateonclick').click(function() {
  $('#question42').toggle();
});
);
</script>

api.jquery.com/toggle/

:)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form