Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Top World Wide Web Interviews:Action ScriptAJAXBasic InternetBloggingCascading Style Sheet CSSCSS3DHTMLDomain Name System (DNS)EcommerceHTMLHTML5JavaScriptjQueryjQuery KnockoutJSONJSONPUser Interface DesignerVBScriptW3CWeb 2.0 TechnologiesWeb 3.0 TechnologiesWeb BuildingWeb DevelopersWeb QualityWeb SecurityWeb SemanticWebmaster
Copyright © 2018. All Rights Reserved
jQuery Interview Question:
Derfine width() vs css('width')?
Submitted by: AdministratorIn jQuery, there are two way to change the width of an element.
One way is using .css('width') and other way is using .width().
For example:
$('#mydiv').css('width','300px');
$('#mydiv').width(100);
★ The difference in .css('width') and .width() is the data type of value we specify or return from the both functions.
★ In .css('width') we have to add "px" in the width value while in .width() we don't have to add.
★ When you want to get the width of "mydiv" element then .css('width') will return '300px' while .width() will return only integer value 300.
Submitted by:
One way is using .css('width') and other way is using .width().
For example:
$('#mydiv').css('width','300px');
$('#mydiv').width(100);
★ The difference in .css('width') and .width() is the data type of value we specify or return from the both functions.
★ In .css('width') we have to add "px" in the width value while in .width() we don't have to add.
★ When you want to get the width of "mydiv" element then .css('width') will return '300px' while .width() will return only integer value 300.
Submitted by:
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.