Welcome, Guest
Username: Password: Remember me

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

[JAVASCRIPT][CSS] refer to the current question, not its ID# 1 year 2 months ago #95535

  • Qat
  • Qat's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 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.
Last Edit: 1 year 2 months ago by Qat.
The administrator has disabled public write access.

[JAVASCRIPT][CSS] refer to the current question, not its ID# 1 year 2 months ago #95547

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
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.
The administrator has disabled public write access.

[SOLVED] - [JAVASCRIPT][CSS] refer to the current question, not its ID# 1 year 2 months ago #95554

  • Qat
  • Qat's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
It works. Simple and elegant.

Thanks a lot for your useful and prompt reply !
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.139 seconds
Donation Image