Found 10483 Articles for Web Development

HTML DOM cancelable Event Property

AmitDiwan
Updated on 07-Aug-2019 12:11:07

175 Views

The HTML DOM cancelable event property is associated with the HTML events as JavaScript can react to these events. The cancelable event property returns a Boolean true or false indicating whether the event can be cancelled or not.SyntaxFollowing is the syntax for cancelable event property −event.cancelableExampleLet us see an example of cancelable event property − Hover over the button below to find out if onmouseover is cancellable event or not CLICK IT    function cancelFunction(event) {       var x = event.cancelable;       if(x==true)          document.getElementById("Sample").innerHTML = "The onmouseover event ... Read More

HTML DOM Button value Property

AmitDiwan
Updated on 20-Feb-2021 06:12:07

256 Views

The HTML DOM Button value property is associated with value attribute of the element. It specifies the hidden value of the button. The value property sets or returns the value of the value attribute of a button. Browsers generally submit the value text when clicked on a button while others submit the text between the element.SyntaxFollowing is the syntax for −Setting the value property −buttonObject.value = textHere, the text property value is the initial value that is given to the button.ExampleLet us see an example of the button value property −Live Demo My Button Click on ... Read More

HTML DOM Button type Property

AmitDiwan
Updated on 07-Aug-2019 12:02:28

298 Views

The HTML DOM Button type property is associated with the HTML element. The button element by default has type=”submit” i.e clicking on any button on the form will submit the form. The button type property sets or returns the type of button.SyntaxFollowing is the syntax for −Setting the button type property −buttonObject.type = "submit|button|reset"Here, the submit|button|reset are button type values. Submit is set by default.Submit − Makes the button a submit button.Button − Makes a normal clickable button.Reset − Makes a reset button that resets the form data.ExampleLet us see an example of the HTML DOM button type property − ... Read More

HTML DOM Button object

AmitDiwan
Updated on 07-Aug-2019 11:57:48

762 Views

The HTML DOM Button object is associated with the element.PropertiesFollowing are the properties for the HTML DOM button object −PropertyDescriptionautofocusTo set or return whether a button is automatically focused or not when the page loads.disabledTo set or return whether a given button is disabled or not.formTo return the reference of the form containing the button.formActionTo set or return the formAction attribute value of a button.formEnctypeTo set or return the formEnctype attribute value of a button.formMethodTo set or return the formMethod attribute value of a button.formNoValidateTo set or return whether the form data should be validated or not on submission.formTargetTo ... Read More

Add a method to a JavaScript object constructor?

Vivek Verma
Updated on 24-Jul-2025 11:26:03

3K+ Views

In JavaScript, adding a method (function) to a constructor is different from adding a method to a regular object. To add a method to a constructor, we need to define it inside the constructor or in its prototype (using which JavaScript objects inherit features from one another). We can create an object in the following ways in JavaScript: Using the function Constructor (older way): function person(){ } const p = new person(); Using ES6 Class Syntax (i.e., modern way): class person{ constructor(){} } const p = new person(); Let's see the various ways to add ... Read More

HTML DOM Button name Property

AmitDiwan
Updated on 07-Aug-2019 11:52:31

284 Views

The HTML DOM Button name property is associated with name attribute of the element. The name property is used to set or return the value of the name attribute of the button. The name attribute is used in forms to select an element using JavaScript.SyntaxFollowing is the syntax for −Setting the name property −buttonObject.name = nameHere, the name property value is used to denote the name of the button.ExampleLet us see an example of the button name property − BUTTON Click the button below and change the above button name. CHANGE    function change() { ... Read More

HTML DOM Button disabled Property

AmitDiwan
Updated on 07-Aug-2019 11:47:41

1K+ Views

The HTML DOM Button disabled property is associated with disabled attribute of the element .The button disabled property is used to set or return whether a given button is disabled or not. It is used to disable the button so that the user can no longer interact with the specified element. Setting the disabled property will grey the button by default in the web browsers.SyntaxFollowing is the syntax for −Setting the disabled property −buttonObject.disabled = true|falseHere, the true|false specifies if the given input button should be disabled or not.True − The button gets disabled.False − The button won’t get disabled.Let us ... Read More

Add a property to a JavaScript object constructor?

Lokesh Yadav
Updated on 09-Dec-2022 05:38:13

862 Views

In this article, we’ll go over how to add a property to a JavaScript object constructor in JavaScript with appropriate examples. Adding a property to an object constructor is different from adding a property to a normal object. If we want to add a property, we have to add it in the constructor itself rather than outside the constructor whereas we can add anywhere in a normal object. To get a better understanding of the given task, let’s look into the syntax and usage of the constructor in JavaScript. Syntax The syntax for a constructor is − Constructor(); // No ... Read More

How to add a method to a JavaScript object?

Lokesh Yadav
Updated on 09-Dec-2022 05:37:08

7K+ Views

In this article, we’ll go over how to add a method to a JavaScript object in JavaScript with appropriate examples. A JavaScript object is an entity which has properties. A property can be a variable or a method which define state and behavior of the object. A method is a property of an object that adds behavior to an object. We can add a method to a JavaScript object using object prototype. All JavaScript objects get their attributes and methods from a prototype. Let’s understand this concept better with the help of examples further in this article. Syntax The syntax ... Read More

Create many JavaScript objects as the same type?

Manisha Patil
Updated on 23-Aug-2022 13:34:16

2K+ Views

JavaScript is a lenient object-oriented language. We'll look at various JavaScript object creation methods in this article. It is crucial to know that JavaScript is an object-oriented language based on prototypes instead of classes before moving on. It can be more difficult to understand how JavaScript enables you to build hierarchies of objects and to get an inheritance of properties and their values because of this different foundation. Programming objects can combine variables, functions, and data structures. In other words, objects can hold values, you can use objects to manipulate values, and you can combine values into more complicated objects, ... Read More

Advertisements