Set height using value returned from a function - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:height

Description

Set height using value returned from a function

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("button").click(function(){
        $("div").height(function(n,c){
        return c+200;/*from   w  w  w . j  av a2  s  . c om*/
        });
    });
});
</script>
</head>
<body>

<button>Increase height of div with 200 px</button><br><br>

<div style="height:100px;border:4px solid;"></div>

</body>
</html>

Related Tutorials