How to get the value of selected option in a select box using jQuery
val() – method returns the value of selected attribute value.var selectedVal = $("#SelectID option:selected").val();text()– method return String of selected option.var selectedVal = $("#SelectID option:selected").text();<!DOCTYPE html>
<html>
    <head>
        <script src="js/jquery-3.1.1.min.js"></script>
        <script>
            $(document).ready(function () {
                $("#myselect").change(function () {
                    // var selectedVal = $("#SelectID option:selected").text();                    var selectedVal = $("#SelectID option:selected").val();                    alert("Hi, your favorite programming language is " + selectedVal);
                });
            });
        </script>
    </head>
    <body>
        <h1>Get the value of selected option in a select box using jQuery</h1>
        <label>Select Programming Language:</label>
        <select id="SelectID">
            <option value="Java">Java</option>
            <option value="C">C</option>
            <option value="PHP">PHP</option>
            <option value="C#">C#</option>
            <option value="C++">C++</option>
        </select>      
    </body>
</html>Get URL in Jquery
var pathname = window.location.pathname; // Returns path only (/path/example.html)
var url      = window.location.href;     // Returns full URL (https://example.com/path/example.html)
var origin   = window.location.origin;   // Returns base URL (https://example.com)
host        www.refulz.com:8082
hostname    www.refulz.com
port        8082
protocol    http:
pathname    index.php
href        http://www.refulz.com:8082/index.php#tab2
hash        #tab2
search      ?foo=789
jQuery('body').css('overflow','hidden');
OR
<style>
 body {width:100%; height:100%; overflow:hidden, margin:0}
 html {width:100%; height:100%; overflow:hidden}
</style> 

 
 
 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
No comments:
Post a Comment
I am Safiqul Islam Tuhin