Featured Categories
-
Lectora®
Lectora® is the most trusted authoring tool in the world. Rock out your creativity! Author courses any way you like. Lectora adheres to best practices for Accessibility and Web Content Accessibility Guidelines (WCAG), offers responsive authoring for eLearning, and publishes to any LMS (Learning Management System).
-
CenarioVR®
Experience virtual reality through CenarioVR®, our training and virtual reality (VR) authoring software that allows you to create immersive learning in minutes! No coding required!
-
Rockstar Learning Platform®
Our Rockstar Learning Platform® has all the features you’ll love. Help your employees be better at their jobs, more valuable to your company, and most effective in servicing your customers.
-
The Training Arcade®
Level up your learner engagement with the Training Arcade®! The Training Arcade is a library of fun, mobile-ready, casual games that can be rapidly customized with your content to create effective gaming!
-
ELB Learning Content
Did you know that our AssetLibrary™ has over 120 million engaging, interactive, and awe-inspiring templates and assets to help you become an eLearning Rockstar®?
Use variable in text for droplist

Hopefully it's something simpler than creating a full blown drop down from scratch, as that's a bit over my head at least for now.
Comments
-
If I am understanding you correctly, you want to have a variable determine the value and text of an option in a drop down, correct? Yup, you can do it (with jQuery).
$('option:nth-child(1)').attr('value',VarVariable1.getValue()).text(VarVariable1.getValue());
This will change whatever the first option is (it doesn't matter) to the value of variable1.
Darrel0 -
By the way, remember that you MUST initialize (use) the variable before it can be manipulated into the select element. Forgot to mention that although my example has it in there.0
-
Edit: Is there a way to target just one drop down when there is more than one on the page? A quick google search suggests that I may need to add a class to the drop down to target it with jquery, but I'm not sure I grasp where/how to add the class in the RunJS or if more language is needed.
I think that will do it, actually - The goal was to have the option read "Text text text <variable value>" In my case, I'm setting a fixed date (assess_date) at the beginning of the course that needs to be added to the end of fixed text. I just fiddled a bit with the sample and think I have the gist enough that I'll be able to implement.
Once again, thank you! BTW - did you get my email message?0 -
Yeah, you can have as many drop downs as you'd like and specifically target any or all of them. Lectora provides class names and ID's to to each select element so there's no need to add any of that. You'll have to append the target by adding additional specificity. I just replied to your email. I would have missed it in hundreds of other emails if you had not mentioned anything. Thank you. Feel free to email me for more on this if you want. I'll look out for this one.
Darrel0 -
With a little more research, I got it! It was just a matter of learning how to add the element id and whether it needed 'id' on the end of the element or not. From there, it was just remembering that I needed the # in front of it, and viola:
$('#combo258138 option:nth-child(2)').attr('value',VarVariable1.getValue()).text(VarVariable1.getValue());
Thanks again for all your help and pushing me at least baby steps into the world of JS and jquery.0 -
Awesome. Great job! Keep going.0
Categories
- 35.9K All Categories
- 110 ✫ Announcements
- 33.2K Lectora®
- 31.1K Lectora Discussions
- 29K Lectora Desktop
- 2K Lectora Online
- 2K Lectora Feature Requests
- 71 Lectora User Groups
- 27 ELB Learning Content
- 27 ELB Learning Content Discussions
- 343 CenarioVR®
- 204 CenarioVR Discussions
- 139 CenarioVR Feature Requests
- 44 Rockstar Learning Platform®
- 41 Rockstar Learning Platform Discussions
- 108 CourseMill®
- 108 CourseMill Discussions
- 48 ReviewLink®
- 48 ReviewLink Discussions
- 7 The Training Arcade®
- 7 The Training Arcade Discussions
- 938 All Things eLearning
- 39 eLearning Development
- 546 Learning Management System (LMS) Integration
- 333 Web Accessibility
- 1.2K ♪ The Green Room
- 9 Additional Learning Products