Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jQuery - Dimensions

//jQuery width() and height() Methods
$("button").click(function(){
  var txt = "";
  txt += "Width: " + $("#div1").width() + "</br>";
  txt += "Height: " + $("#div1").height();
  $("#div1").html(txt);
});

//jQuery innerWidth() and innerHeight() Methods
$("button").click(function(){
  var txt = "";
  txt += "Inner width: " + $("#div1").innerWidth() + "</br>";
  txt += "Inner height: " + $("#div1").innerHeight();
  $("#div1").html(txt);
});

//jQuery outerWidth() and outerHeight() Methods
$("button").click(function(){
  var txt = "";
  txt += "Outer width: " + $("#div1").outerWidth() + "</br>";
  txt += "Outer height: " + $("#div1").outerHeight();
  $("#div1").html(txt);
});

//The width() method sets or returns the width of an element (excludes padding, border and margin).
//The height() method sets or returns the height of an element (excludes padding, border and margin).

//The innerWidth() method returns the width of an element (includes padding).
//The innerHeight() method returns the height of an element (includes padding).

//The outerWidth() method returns the width of an element (includes padding and border).
//The outerHeight() method returns the height of an element (includes padding and border).
Comment

PREVIOUS NEXT
Code Example
Javascript :: JavaScript / jQuery DOM Selectors 
Javascript :: jquery if each checkbox is checked push array using each site:stackoverflow.com 
Javascript :: Knockout js custom bindings 
Javascript :: javascript addall 
Javascript :: Photoshop extendscript javascript save to text file a list of layers 
Javascript :: mongoose findbyidandupdate or findoneandupdate 
Javascript :: switch javascript to java 
Javascript :: npm function-memoizer 
Javascript :: flip image on x axis phaser 
Javascript :: Disemvowel Trolls 
Javascript :: phaser random rectangle 
Javascript :: phaser enable pixel art 
Javascript :: phaser animation yoyo 
Javascript :: swr vs axios 
Javascript :: scan token deploy js 
Javascript :: get random item in array 
Javascript :: prevent alpine js from rendering components during refresh 
Javascript :: moment js with nodejs 
Javascript :: javascript setinterval run immediately 
Javascript :: loop in object 
Javascript :: js brightness 
Javascript :: event listener 
Javascript :: destructuring in javascript 
Javascript :: dayjs subtract days 
Javascript :: find duplicates array javascript 
Javascript :: js date minus 18 years 
Javascript :: how to log all messages discord.js 
Javascript :: .unshift 
Javascript :: discord.js lock channel 
Javascript :: reference data types in javascript 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =