Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aatronco/b4cf5694aafd5becc2b4b91f83c3f50a to your computer and use it in GitHub Desktop.
Save aatronco/b4cf5694aafd5becc2b4b91f83c3f50a to your computer and use it in GitHub Desktop.
<!-- creates a custom select on the Contact page -->
<div id="custom_select_container" class="field col-md-12">
<label for="contactpage_name" class="required control-label">Custom Field <em>*</em></label><br>
<select id="custom_select" class="text form-control" required="required" >
<option value=""></option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</select>
</div>
<script>
$(document).ready(function(){
$("#custom_select_container").insertBefore("#contactpage_message")
});
$('#contact_form').submit(function() {
text = document.getElementById("contact_message").value
$("#contact_message").val(text + "\nSelected Option: " + $("#custom_select option:selected").text() )
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment