Display The Selected Value Of A Drop Down List In A Text Field (javascript) In A Post Wordpress
I am trying to display the selected value from the drop down list in a text field in a wordpress post. But the code its not fetching the values.
Whenever your drop down value changes it will change the value in input field value. You can go through the following code :
<script>functiongetValue(value) {
alert(value);
$('#txtprice').val(value);
}
</script><selectname="cmbitems"id="cmbitems"onchange="getValue(this.value)"><optionvalue=""selected="selected">Select Country</option><optionvalue="£0.0">Ireland</option><optionvalue="£2.50">United States</option><optionvalue="£2.50">United Kingdom</option><optionvalue="£2.50">Afghanistan</option><optionvalue="£2.50">Albania</option><optionvalue="£2.50">Algeria</option><optionvalue="£2.50">American Samoa</option><optionvalue="£2.50">Andorra</option></select><inputid="txtprice" />
You have a mistake on script start in first line:
<select name="cmbitems"id="cmbitems"> <**style** type="text/javascript">
TRy to use the correct script tag instead of
<**style** type="text/javascript">
<**script** type="text/javascript">
Post a Comment for "Display The Selected Value Of A Drop Down List In A Text Field (javascript) In A Post Wordpress"