Display Drop Down Selected Option In Php August 29, 2023 Post a Comment I want to display a simple html drop down box and selected value want to print. FlipkartSolution 1: Use jQuery$(document).ready(function(){ $(".showDescriptionTextbox").val($(".Product").val());//to initialize $(".showDescriptionDiv").text($(".Product").val());//to initialize $(".Product").change(function(){ $(".showDescriptionTextbox").val($(".Product").val()); $(".showDescriptionDiv").text($(".Product").val()); }); });Copy<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><selectname="v"class="Product"id="dropdown"><optionvalue="fkt">Flipkart</option><optionvalue="snd">Snapdeal</option></select><br/><br/> value in textarea: <inputtype="text"class="showDescriptionTextbox"><div> or you can display value in div: <spanclass="showDescriptionDiv"></span></div>CopySolution 2: <selectname="v"class='Product'><optionvalue="fkt">Flipkart</option><optionvalue="snd">Snapdeal</option></select><textareaclass='showDescription'></textarea><br><scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script><script> $(function(){ $('.Product').change(function(){ varProduct = $('.Product').val(); $(".showDescription").val(Product); }); }); </script>CopySolution 3: Check for it.functionshop(shop) { $("#show").val(shop); } Copy<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script><selectonchange="shop(this.value)"><optionvalue="Flipkart">Flipkart</option><optionvalue="Snapdeal">Snapdeal</option></select><br/><br/><inputtype="text"id='show'>Copy Share Post a Comment for "Display Drop Down Selected Option In Php"
Post a Comment for "Display Drop Down Selected Option In Php"