How to set a default attribute to all elements

Razor23 Donetsk

For example, I have the following code

<form>
  <input type="text" required="true">
  <input type="text" required="true">
  <button type="submit">Click</button>
</form>

Guys, is it possible to set a default value "true" to the attribute "required"? Something like this:

<form required="true">
  <input type="text">
  <input type="text">
  <button type="submit">Click</button>
</form>
Zenocode

The required option on input is removable by the user easily by inspecting the source code.

I think the best way to do that is to check all input with a javascript function call before sending the data like it's explain in the example bellow.

https://www.w3schools.com/js/js_validation.asp

Edit :

<form id="yourFormId">
   ..
</form>

And if you want you can use JQuery, just do :

$('#yourFormId').submit(function() {
    // Something
    return true; // True submit your form.
    //return false; // False cancel your form.
});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Java 8: How to compare all elements of a Set

How to set the default value of an attribute on a Laravel model

How to set the value of a default attribute of a Mongoose schema based on a condition

Yii2: How to set default attribute values in ActiveRecord?

Set default output value if frequency of all input elements is the same

How to temporarily set all elements' tabindex attribute and be able to reset all elements to their original tabindex?

How to use the default value for an attribute set in nixos, and extend it

How to set a dynamic JavaScript array with HTML elements and then set an Attribute to them

How to set a callable function to AutoField default attribute?

Attribute Goes Into All Elements

How do I print all elements in set?

How to set model field default the same as OneToOneField attribute value?

How to to set the default value of a virtual attribute using the attribute API

Redis how to clear all the elements in a set

How to set "all values" as default in a multiple select?

Get all attributes of an attribute set that is not present in default attribute set

How to set the default value of directive attribute?

How to change attribute of elements in a set cpp

How to set a default value for attribute if it doesn't exist in the XDocument object

How to set Default CSS for all Buttons in JAVAFx

How to set default DISPLAY for all SSH sessions?

How to add set -e to all default bashes?

Select all the elements within an element having an attribute set to a specific value

How to set default workspace location for all users?

How to set an instance attribute for all instances of a class

How to set background color for all elements with the same class individually based on custom attribute

How to set "Room Bounding" attribute on all elements in Revit API

How to set a default model attribute if the one is missing?

How to change properties of all set elements in Swift