Populate text area with values from custom attributes in dropdown

jQuery(document).ready(function($){
//this populates the readonly text area with the event details
jQuery(‘#input_1_1’).change(function(){
var datetime = $(‘option:selected’, this).attr(‘datetime’);
var venue = $(‘option:selected’, this).attr(‘venue’);
var address = $(‘option:selected’, this).attr(‘address’);
var city = $(‘option:selected’, this).attr(‘city’);
var state = $(‘option:selected’, this).attr(‘state’);
var zip = $(‘option:selected’, this).attr(‘zip’);

jQuery(‘#input_1_2’).val( datetime + “\n”+ venue + “\n”+ address + “\n” + city + “, ” + state + ” ” + zip );

})

});

Leave a Reply