i want something like when i select a value on the dropdownlist, that particular value has to show on my submit button. Please check the link below for what i mean https://www.elefant-tours.de/ueber-uns/reiseanmeldung/?wetu_id=15FAC4B2-C939-4179-918D-E3140BA3177E
Example of that behavior with jquery.
You need to match the select id and also insert a span tag inside the button with a matching class
Live example:
https://jsfiddle.net/1qjvtc86/
From gravityforms site:
there is an easy way to add custom Javascript to your Gravity Forms that only loads when the form is rendered. Just copy-and-paste your desired snippet into the robust editor on your Form Settings and you're golden.
<div>
<select id="picker">
<option value="5">5 items</option>
<option value="4">4 items</option>
<option value="3">3 items</option>
<option value="2">2 items</option>
<option value="1">1 items</option>
</select>
</div>
<div>
<button>user picked <span class="pickedAmount">1</span> items</button>
</div>
<!-- copy this into gravity form -->
<script>
// picker - is the ID of the select
// pickedAmount - is the CLASS of the span
jQuery(function($){
$('#picker').on('change', function() {
$('.pickedAmount').text($(this).val());
})
});
</script>
<!-- copy this into gravity form -->
Your JavaScript solution is :
<select onchange="my_fun(this)">
<option>item one(1)</option>
<option>item two(2)</option>
<option>item three(3)</option>
</select>
<script>
function my_fun(obj){
alert(obj.options[obj.selectedIndex].text);
}
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.