PHP Classes

File: public/asset/vendor/select2/docs/plugins/simplesearch/js/simplesearch.js

Recommend this page to a friend!
  Classes of fathurrahman   mnTemplate   public/asset/vendor/select2/docs/plugins/simplesearch/js/simplesearch.js   Download  
File: public/asset/vendor/select2/docs/plugins/simplesearch/js/simplesearch.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: mnTemplate
Route HTTP requests to callback functions
Author: By
Last change:
Date: 1 year ago
Size: 1,089 bytes
 

Contents

Class file image Download
((function(){ var findAncestor = function(el, selector) { while ((el = el.parentElement) && !((el.matches || el.matchesSelector).call(el, selector))) {} return el; }; var fields = document.querySelectorAll('input[name="searchfield"][data-search-input]'); fields.forEach(function(field) { var form = findAncestor(field, 'form[data-simplesearch-form]'), min = field.getAttribute('min') || false, location = field.getAttribute('data-search-input'), separator = field.getAttribute('data-search-separator'); if (min) { var invalid = field.getAttribute('data-search-invalid'); field.addEventListener('keydown', function() { field.setCustomValidity(field.value.length >= min ? '' : invalid); }); } form.addEventListener('submit', function(event) { event.preventDefault(); if (field.checkValidity()) { window.location.href = location + separator + field.value; } }); }); })());