jQuery innerHeight()

jQuery innerHeight() method returns the inner height of the selected element. Padding is included in this method but not the border and margin. Syntax: $(selector).innerHeight() Example1: <!DOCTYPE html> <html> <head> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js”></script> <script> $(document).ready(function(){ $(“button”).click(function(){ alert(“Inner height of the div is: ” + $(“div”).innerHeight()); }); }); </script> </head> <body> <div style=”height:100px;width:500px;padding:5px;margin:3px;border:1px solid blue;background-color:lightpink;”></div><br> <button>Height</button> </body> … Read more

jQuery innerWidth()

jQuery innerWidth() method returns the inner width of the selected element. Padding is included in this method but not the border and margin. Syntax: $(selector).innerWidth() Example1: <!DOCTYPE html> <html> <head> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js”></script> <script> $(document).ready(function(){ $(“button”).click(function(){ alert(“Inner width of the div is: ” + $(“div”).innerWidth()); }); }); </script> </head> <body> <div style=”height:100px;width:500px;padding:5px;margin:3px;border:1px solid blue;background-color:lightpink;”></div><br> <button>Width</button> </body> … Read more

jQuery height()

jQuery height() method sets or returns the height of the selected element. Syntax: When used to return the height: $(selector).height() When used to set the height: $(selector).height(value) When used to set the height using a function: $(selector).height(function(index,currentheight)) Value: Value is a compulsory parameter of the jQuery height() method, as it specifies the height to set … Read more

jQuery width()

jQuery width() method sets or returns the width of the selected element. Syntax: When used to return the width: $(selector).width() When used to set the width: $(selector).width(value) When used to set the width using a function: $(selector).width(function(index,currentwidth)) Value: Value is a compulsory parameter of the jQuery width() method, as it specifies the width to set … Read more

jQuery toggleClass()

The jQuery toggleClass() method adds or removes one or more classes of the selected element. If the class name is already added, toggleclass() method removes it and if the class name was removed earlier, it adds the class name, creating a toggle effect. Syntax: $(selector).toggleClass(classname,function(index,currentclass),switch) Classname: Classname is a compulsory parameter of the jQuery toggleClass() … Read more

jQuery hasClass()

The jQuery hasClass() method checks whether the selected elements have specified class names or not. Return Value: TRUE:  If the specified class is present in any of the selected elements. FALSE. If the specified class is not present in any of the selected elements. Syntax: $(selector).hasClass(classname) Classname: Classname is a compulsory parameter of the jQuery … Read more

jQuery addClass()

The jQuery addClass() method adds one or more class names to the selected element. Syntax: $(selector).addClass(classname,function(index,oldclass)) Classname: Classname is a compulsory parameter of the jQuery addClass() method, as it specifies the class names to be added. Function: It is an optional parameter. The function parameter is used to return the property’s class names to be … Read more

jQuery offset()

The jQuery offset() method sets or returns the offset coordinates of the selected elements. Syntax: When used to return the offset coordinates. $(selector).offset() When used to set the offset coordinates. $(selector).offset({top:value,left:value}) When used to set the offset coordinates using a function. $(selector).offset(function(index,currentoffset)) {top:value,left:value}: It is a mandatory parameter that specifies the top and left coordinates … Read more

jQuery prop()

The jQuery prop() method sets or returns attributes or values of the selected elements. Syntax: When used to return the property’s value: $(selector).prop(property) When used to set the property and value: $(selector).prop(property,value) When used to set the property and value by using a function: $(selector).prop(property,function(index,currentvalue)) When used to set multiple properties and values: $(selector).prop({property:value, property:value,…}) … Read more