Tell me how to make, when clicking on a link, the width of the page (or the block inside the page) is changed?

    1 answer 1

    Using styles:

    function setBoxWidth() { $(".box").css("width", "400px"); } 
     .box { width: 200px; border: 1px solid red; } 
     <script src="//code.jquery.com/jquery.min.js"></script> <div class="box">test</div> <br /> <button onclick="setBoxWidth()">Изменить ширину</button> 

    • <br> is an empty element, it means that it has no content and the closing tag - Mr. Black
    • That's right, better read the html markup :) - ikerya
    • one
      why <br /> wrong entry? this is xhtml - soledar10
    • @ soledar10, in XHTML yes, only <br /> , because in XML all tags must be closed. And then HTML, I don’t need extra slash and have already written the first comment why - Mr. Black
    • @ soledar10, let's say <br></br> = <br /> . With <br></br> browser transforms already two hits <br><br> . What is not proof? - Mr. Black