CSS-Html-JqueryNo Comments

default thumbnail

Using jquery width() method, you can get the width of a HTML element and width(value) is used to set the width of a HTML element. Here is how to do.


        <input type="text" class="input-box">
        <button type="button" class="btn">Set Width</button>

<div class="box">This is simple box</div>


        float: left;
        background: #f2f2f2;
        border: 1px solid #ccc;


        var val = $(".input-box").val();

To check the code, enter some number in input box and click on the button. Box width will increase automatically.

Be the first to post a comment.

Add a comment