adspace


explain width() vs css(‘width’) in jquery

Answer Posted / Dharmendra Kumar Mourya

[n {n "method": ".width",n "description": "Returns the width of an element, in pixels. The value includes padding but not border or margin.n ",n "example": "n $('div').width(); // Returns the width of the first div on the page in pixels"n },n {n "method": "css('width')",n "description": "Returns or sets the CSS property value for the specified style. In this case, 'width'.n ",n "example": "n $('div').css('width', '200px'); // Sets the width of the first div on the page to 200 pixelsn $('div').css('width'); // Returns the CSS 'width' value for the first div on the page"n }n]

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to always reference latest version of jquery?

875


How do you install/use jquery in a project. What is the minimum setup needed to start using jquery.

999


How to validate email using jquery?

975


Do you have plans for a new jquery plug-in or something else we should look out for? Where to from here for the imgpreview plugin?

864


How can jquery library be added to pages?

952


What is the minimum setup needed to start using jquery.

939