Bienvenue, Invité
Nom d'utilisateur : Mot de passe : Se souvenir de moi

SUJET : [JAVASCRIPT][CSS] refer to the current question, not its ID#

[JAVASCRIPT][CSS] refer to the current question, not its ID# il y a 1 an 6 mois #95535

  • Qat
  • Portrait de Qat
  • Hors ligne
  • Fresh Lemon
  • Messages : 14
  • Karma: 0
Hello everyone.

My javascript/css knowledge is poor, and I couldn't find the answer to my question after 15 minutes searching, so I turn to you guys.

I found out how to change the looks of a specific question through javascript. I enter the following code inside the question source. So far, so good.
<script type="text/javascript" charset="utf-8">
 $(document).ready(function(){
  $('#question396 .survey-question').css({
    'border-bottom':'0px',
    'margin-bottom':'-10px'
   }); 
 });
</script>

I want to do this for several question, and I'd like to make my code more portable : remove the reference to the specific question (#question396). Since the code is inserted inside the question code, is there a way to refer to the current question ?

I hope I'm clear enough.
Dernière édition: il y a 1 an 6 mois par Qat.
L'administrateur a désactivé l'accès en écriture pour le public.

[JAVASCRIPT][CSS] refer to the current question, not its ID# il y a 1 an 6 mois #95547

  • tpartner
  • Portrait de tpartner
  • Hors ligne
  • LimeSurvey Team
  • Messages : 4369
  • Remerciements reçus 828
  • Karma: 381
Try:
<script type="text/javascript" charset="utf-8">
	$(document).ready(function(){
		$('#question{QID} .survey-question').css({
			'border-bottom':'0px',
			'margin-bottom':'-10px'
		}); 
	});
</script>
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
L'administrateur a désactivé l'accès en écriture pour le public.

[SOLVED] - [JAVASCRIPT][CSS] refer to the current question, not its ID# il y a 1 an 6 mois #95554

  • Qat
  • Portrait de Qat
  • Hors ligne
  • Fresh Lemon
  • Messages : 14
  • Karma: 0
It works. Simple and elegant.

Thanks a lot for your useful and prompt reply !
L'administrateur a désactivé l'accès en écriture pour le public.
Modérateurs: ITEd
Temps de génération de la page : 0.138 secondes
Donation Image