Help with .val /. find with select boxes
I am using the following code:
- $(function(){
- $(this).on('change','select#type',(function(){
- var defaultVal = $(this).find(":selected").attr('default');
- $('select#agegroup').val(defaultVal);
- }));
- });
It controls take the select box "type" and applies a default value to select box "agegroup." I recently have made it so that several of these select boxes can be added on the same page to enter multiple values at once. However, when a change is made to the "type" select box, all of the "agegroup" select boxes are changed to the default value of the type just selected.
Is there a way to make it so that the find will only affect the select box in the current div? The whole code can be seen at:
http://jsfiddle.net/uGLZ4/5/