Found 2416 Articles for HTML

HTML DOM Clipboard event

AmitDiwan
Updated on 07-Aug-2019 13:38:41

329 Views

The HTML DOM Clipboard event is used to provide information regarding modification of the clipboard. The events can be cut, copy and paste. The Clipboard event can be used to make your site more accessible i.e. giving user information on how the clipboard is being modified.PropertiesFollowing is the property for Clipboard event −PropertyDescriptionclipboardDataTo return an object containing the data affected by the clipboard operation(cut, copy or paste).EventsFollowing are the event types belonging to the Clipboard event −EventDescriptiononcopyThis event fires when the content of an element is copied by the user.OncutThis event fires when the user cuts the content of an ... Read More

HTML DOM clientWidth Property

AmitDiwan
Updated on 07-Aug-2019 13:36:49

70 Views

The HTML DOM clientWidth property is used to get the viewable width of an HTML element. This width includes padding but excludes any border, scrollbar and margins. It will only return the element width even if the content overflows from the element.SyntaxFollowing is the syntax for clientWidth property −element.clientWidthExampleLet us see an example for the HTML DOM clientWidth property − #divStyle {    width: 200px;    height: 200px;    padding: 10px;    margin: 15px;    border: 5px solid blue;    background-color: lightgreen; } Click the below button to get the widhth of the div ... Read More

HTML DOM clientTop Property

AmitDiwan
Updated on 07-Aug-2019 13:28:56

20 Views

The HTML DOM clientTop property returns the width of the top border of an element in pixels. It is a read-only property. Top margin or top padding of an element are not included by this property.SyntaxFollowing is the syntax for clientTop property −element.clientTop;ExampleLet us see an example of the clientTop property − #styleDiv {    height: 250px;    font-size:35px;    text-align:center;    width: 400px;    padding: 10px;    margin: 15px;    border-top: 15px solid blue;    background-color: lightgreen; } Click the below button to get the div top border width in pixels TOP ... Read More

HTML DOM clientLeft Property

AmitDiwan
Updated on 07-Aug-2019 13:25:09

28 Views

The HTML DOM clientLeft property returns the width of the left border of an element in pixels. It is a read-only property. This property will include the width of a vertical scrollbar but it will never include the left margin or left padding of an element.SyntaxFollowing is the syntax for clientLeft property −element.clientLeftExampleLet us look at an example for the HTML DOM clientLeft property − #styleDiv {    height: 200px;    width: 200px;    padding: 5px;    margin: 10px;    border-left: 10px solid blue;    background-color: lightgreen; } Click the below button to get ... Read More

HTML DOM clientHeight Property

AmitDiwan
Updated on 20-Feb-2021 05:58:04

257 Views

The HTML DOM clientHeight property is used to get the viewable height of an HTML element . This height includes padding but excludes any border, scrollbar and margins. It will only return the element’s height even if the content overflows from the element.It can be calculated as −CSS height+ CSS padding – border –scrollbar(horizontal) – marginsSyntaxFollowing is the syntax for clientHeight property −element.clientHeightExampleLet us look at an example for the HTML DOM clientHeight property −Live Demo #styleDIV {    height: 250px;    padding: 10px;    margin: 15px;    border: 2px solid blue;    background-color: lightgreen;    text-align:center; ... Read More

HTML DOM click() method

AmitDiwan
Updated on 07-Aug-2019 13:14:24

251 Views

The HTML DOM click() method simulates a mouse-click on an element. It can be used to click on any element just like a user would do. This is used to fire the elements click event. The click event does event bubbling i.e. it will execute the click event of all its parents too.SyntaxFollowing is the syntax of HTML DOM click() method −HTMLElementObject.click()ExampleLet us see an example for the click() method − Hover over the radio button to simulate a mouse-click. Radio

HTML DOM className Property

AmitDiwan
Updated on 07-Aug-2019 13:07:13

69 Views

The HTML DOM className property is used to assign a css class to an HTML element. The className property is used for setting or returning an element’s class name attribute value. If no class is associated with an HTML element, then an empty string is returned. We can change a class name contained with an element using this property −SyntaxFollowing is the syntax for −Setting the className property −HTMLElementObject.className = class;Here, the class value is used to specify the class name of an element. An element can have multiple classes associated with it separated by spaces.ExampleLet us see an example ... Read More

HTML DOM classList Property

AmitDiwan
Updated on 20-Feb-2021 06:00:18

289 Views

The HTML DOM classList property is used to return the class names associated with an HTML element. It returns the class names in the form of a DOMTokenlist . The DOMTokenlist is nothing but a set of space-seperated tokens. This property is useful in adding, removing or toggling css classes of an element.The classList property is a read-only property but you can add or remove classes of an element using the add() and remove() method.PropertiesFollowing is the property of classList −PropertyDescriptionLengthTo return the number of classes in the list. It is read-only.MethodsFollowing are the methods of classList −MethodDescriptionadd(class1, class2, class ... Read More

HTML DOM cite object

AmitDiwan
Updated on 20-Feb-2021 06:01:28

79 Views

The HTML DOM cite object is associated with the HTML element. The element is used to give reference to a cited creative work and title must be included. It can be painting, book, tv show, movies etc.SyntaxFollowing is the syntax for −Creating a cite object −var x = document.createElement("CITE");ExampleLet us see an example of the HTML DOM cite object −Live Demo Click the below button to create a CITE element. CREATE    function createCite() {       var x = document.createElement("CITE");       var t = document.createTextNode("The Starry night.");       ... Read More

HTML DOM children Property

AmitDiwan
Updated on 20-Feb-2021 06:02:39

237 Views

The HTML DOM children property is used to return all the child elements of the specified element in the form of HTML collection. It is only a read-only property. The elements obtained can then be accessed by using index numbers which starts from 0.The elements appear in the same order as they are in the HTML document. It contains only children nodes and doesn’t include whitespace and comments like childNodes property.SyntaxFollowing is the syntax for the children property −element.childrenLet us see an example of the HTML DOM children property −Live Demo    div {       ... Read More

Advertisements