I\'ve this code:
Please call the following method:
window.dispatchEvent(new Event('resize'));
You can't declare functions that way, use it like this.
<script>
$(document).ready(larg);
$(window).resize(larg);
function larg(){
var larghezza = $(document).width();
$("p.width").text("The width for the " + larghezza + " is px.");
}
</script>
EDIT: changed code a bit, thanks commenters