Jquery Show Browser With And Height Code Tutorial

Jquery Show Browser With And Height Code Tutorial

Jquery Show Your desktop With And Height To Copy code And Oen Your Browser
Now Type This Code

<!DOCTYPE html>
<html>
<head>
/* This Api Documention For Jquery */
<script 
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
/* Jquery Script  And Now Veriable is txt*/
<script>
$(document).ready(function(){
    $("button").click(function(){
        var txt = "";
        txt += "Document width/height: " + $(document).width();
        txt += "x" + $(document).height() + "\n";
        txt += "Window width/height: " + $(window).width();
        txt += "x" + $(window).height();
        alert(txt);
    });
});
</script>
</head>
<body>

/* Get Button */
<button>Display dimensions of document and window</button>
</body>
</html>

Now Type This Code 2 With Easy To Use And Easy To Understanding

<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("button").click(function(){
        var txt = "";
        txt = "Width of div: " + $("#div1").width() + "</br>";
        txt += "Height of div: " + $("#div1").height();
        $("#div1").html(txt);
    });
});
</script>
</head>
<body>

<div id="div1" style="height:100px;width:300px;padding:10px;margin:3px;border:1px solid blue;background-color:lightblue;"></div>
<br>

<button>Display dimensions of div</button>
<p>width() - returns the width of an element.</p>
<p>height() - returns the height of an element.</p>
</body>

</html>







Related Post

Next
Previous
Click here for Comments

0 comments:

Thnak You For Comment And For Your Question, Answer Very Soon.