AndrewMantarro
9/11/2017 - 12:26 AM

Allow user to choose email address for form. This code allows you to set up a 'select' field in a form which will allow the user to set the

Allow user to choose email address for form. This code allows you to set up a 'select' field in a form which will allow the user to set the email destination of the form. Example: http://www.wewashushop.com.au/contact.html

$(function(){
    // When the location changes
    $("[name='e_Location']").change(function(){
        // Get the value of the select
        var value = $(this).val()
        // Set the hidden mailTo input to be the email address
        $("[name='mailTo']").val(value)
                });
});
<select name="e_Location">
<option value="Please Select">Please Select</option>
<option value="site1@wewashushop.com.au">Frankston - Olsen street</option>
<option value="site2@wewashushop.com.au">Frankston - Beach Street</option>
<option value="site3@wewashushop.com.au">Frankston - Wells Street</option>
</select>