Show/Hide divs for multiple selects
I have a jquery function that will show or hide a div id="hide1" based on the result of a select id="ticket1"
- $(document).ready(function(){
- $('#hide1').hide();
- $('#ticket1').change(function(){
- if(this.value == 'adult'){$('#hide1').hide();}
- if(this.value == 'child'){$('#hide1').show();}
- });
- $("#ticket1").change();
- });
It works well! But my script actually clones elements of the form so a user could be selecting adult or child for a number of tickets - ticket1,ticket2,ticket3....
How can I adapt that script so that it will show/hide for each ticket please?