Question on the Double Select Dropdown List example/code from: https://coursesweb.net/javascript/multip ... vascript_t
I have this example working for my application, and have learned a couple of things. I can't figure out how to store for display the key in the SList.scontent and where to add that line of code.
In the example below, I want to put in a variable for display later on the key word ajax:
Select WebSite: MarPlo.net Select Category: ajax
http://www.marplo.net/ajax/
my understanding is not at that level yet.
Thanks
Multiple Select Dropdown List with JavaScript - Get key
-
- Posts:4
Multiple Select Dropdown List with JavaScript - Get key
Admin
Posts:805
Hi
The "option" parameter in the getSelect() method contains the selected option /value, which is the key in the SList objects.
If you want to store that value (key) in a variable for using it later, you can make like in this example:
- Define your variable before the SList object, and assing to it the the value of the option parameter in the getSelect() method.
The "option" parameter in the getSelect() method contains the selected option /value, which is the key in the SList objects.
If you want to store that value (key) in a variable for using it later, you can make like in this example:
Code: Select all
var some_var =''; //Your Variable
var SList = new Object();
//the rest of code for SList object...
SList.getSelect = function(slist, option){
some_var = option; //store current selected option /key
//the rest of code of this method...
}
dmgatwork
Posts:4
This worked just fine, got the info out of the object I needed. Still getting up to speed on objects. Thanks again.
Similar Topics
- Hour and Minutes togheter in Javascript
JavaScript - jQuery - Ajax First post
Dear Coursesweb I can not find out how to add the hours + minutes togheter.Last post
<SCRIPT LANGUAGE= JavaScript >
day = new Date()
hr =...
See and use the following example:
<script>
var day = new Date();
let hr = day.getHours();
let mn = day.getMinutes();
let se =... - Display message to every minute in Javascript
JavaScript - jQuery - Ajax First post
Hello,Last post
On eatch minute from the current hour I wanna have an message
I can not find out how to complete
I hope to get something like this (code...
If you only want to display a message to every minute, just use the setInterval() function. It calls a function repeatedly, over and over again, at...