Display Drop Down Selected Option In Php November 30, 2022 Post a Comment I want to display a simple html drop down box and selected value want to print. Flipkart Solution 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 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <select name="v" class="Product" id="dropdown"> <option value="fkt">Flipkart</option> <option value="snd">Snapdeal</option> </select> <br/> <br/> value in textarea: <input type="text" class="showDescriptionTextbox"> <div> or you can display value in div: <span class="showDescriptionDiv"></span> </div>Copy Solution 2: <select name="v" class='Product'> <option value="fkt">Flipkart</option> <option value="snd">Snapdeal</option> </select> <textarea class='showDescription'></textarea> <br> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> $(function(){ $('.Product').change(function(){ var Product = $('.Product').val(); $(".showDescription").val(Product); }); }); </script> Copy Solution 3: Check for it. function shop(shop) { $("#show").val(shop); } Copy <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <select onchange="shop(this.value)"> <option value="Flipkart">Flipkart</option> <option value="Snapdeal">Snapdeal</option> </select> <br/> <br/> <input type="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"