Expert Refresh

Get width

1) Get element width




2) Which is incorect?







<script src=""></script> <div id='mydiv'>my text</div> <script> $('#mydiv').css('background', 'red'); // set width with css $('#mydiv').css('width', '100'); // get element width console.log("Element Width: " + $('#mydiv').width()); // Width: 100 // -- Look Here -- // // get document width console.log("Document Width: " + $(document).width()); // Width: 738 // set element width $('#mydiv').width(2000); // Width is now 2000 // -- Look Here -- // </script>


References



n/a