Explain width() vs css(‘width’)?



Explain width() vs css(‘width’)?..

Answer / Rashmi Meena

In jQuery, `.width()` returns the current width of an element including padding but excluding border and margin, while `.css('width')` retrieves or sets the CSS 'width' property for an element. If you need to set the width including padding, border, and margin, use `.outerWidth()`.nnExample: `var width = $('element').width();` vs `$('element').css('width', '200px');`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More jQuery Interview Questions

What are source maps in jQuery?

1 Answers  


How do you check or uncheck a checkbox input or radio button?

1 Answers  


Tell me which program is useful for testing jquery?

1 Answers  


How to executed jquery selectors? : jquery mobile

1 Answers  


Explain the difference between $(this) and 'this' in jquery?

1 Answers  


Explain .on()? : jquery mobile

1 Answers  


What is .siblings() method in jquery?

1 Answers  


Consider a scenario where things can be done easily with javascript, would you still prefer jQuery?

1 Answers  


Explain jquery connect?

1 Answers  


How you get server response from an ajax request using jquery?

1 Answers  


What are the difference between empty(), remove() and detach() functions in jquery?

1 Answers  


Tell me how to executed jquery selectors? : jquery mobile

1 Answers  


Categories