Hello.
I try to make a certain functionality for convenience of the organization of dependent drop-down lists.
Those. So as not to copy the same code, which will have only different names.
In general, this is not what the jsfiddle example
Especially on jsfiddle
to make it clear.
The changeSelectList
function apparently takes three parameters.
id
from the firstselect
(not important in this case)select_value
is theID
that will be in the second selection inoption value
select_name
is the name that will be inoption
If I do in each
sselect.append('<option value="'+this.type+'">'+this.color+'</option>');
Where type
and color
(these are keys in an array), then all the rules and it displays to me as expected.
If I try to use function arguments
sselect.append('<option value="'+this.select_value+'">'+this.select_name+'</option>');
then in response I get undefined
. I understand very little in JS, do not be angry)
Nagulyulsya why does not work did not work.
I would be grateful for the help.