Misc notes (Jenny)

Home » Uncategorized » Misc notes (Jenny)
Uncategorized No Comments

Jquery

Javascipt

Javascript

Find Object from a list of array or map

myArray = [{'id':'73','foo':'bar'},{'id':'45','foo':'bar'}, etc.]
myArray.find(x => x.id === '45').foo;

TRigger

Datatable

Form

Trigger validation

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

form.checkValidity()
object.checkValidity()

Reset Form

document.getElementById('formId').reset();

Remove validation css

$('#formId').removeClass( "was-validated" );

Prevent submission

$("#editMatchScoreForm").submit(function(e) {
       e.preventDefault(); // avoid to execute the actual submit of the form.
}