propagating select form values throughout DOM based on multiple class
names via jQuery
Having a bunch of drop-down lists all sharing the same (several) class
attributes I want to propagate their values through the DOM upon change.
<input type='select' class='drpdwn required'>(...)</input>
So, this works:
$("select").change(function() {
var newval = $(this).val();
var the_class = $(this).attr('class');
var ar = the_class.split(" ");
the_class = ar[0];
$("."+the_class).val(newval);
});
But it also changes
<input type='select' class='drpdwn not_required'>(...)</input>
And this doesn't propagate:
$("select").change(function() {
var newval = $(this).val();
var the_class = $(this).attr('class');
$("."+the_class).val(newval);
});
What am I missing? Can I not select an element via jQuery like this?
$('.three class names')
?
Thanks.
No comments:
Post a Comment