Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

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

[JAVASCRIPT][CSS] refer to the current question, not its ID# 11 Monate 2 Wochen her #95535

  • Qat
  • Qats Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 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.
Letzte Änderung: 11 Monate 2 Wochen her von Qat.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

[JAVASCRIPT][CSS] refer to the current question, not its ID# 11 Monate 2 Wochen her #95547

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 3813
  • Dank erhalten: 683
  • Karma: 328
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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

[SOLVED] - [JAVASCRIPT][CSS] refer to the current question, not its ID# 11 Monate 2 Wochen her #95554

  • Qat
  • Qats Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 14
  • Karma: 0
It works. Simple and elegant.

Thanks a lot for your useful and prompt reply !
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.140 Sekunden
Donation Image