Last active
June 3, 2021 15:35
-
-
Save aatronco/b4cf5694aafd5becc2b4b91f83c3f50a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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