0%

no need jquery

no need jquery

···
function setHeight(el, val) {
if (typeof val === “function”) val = val();
if (typeof val === “string”) el.style.height = val;
else el.style.height = val + “px”;
}

setHeight(el, val);
···

function ready(fn) {
if (document.readyState != ‘loading’){
fn();
} else {
document.addEventListener(‘DOMContentLoaded’, fn);
}
}

$(el).trigger(‘change’);

// For a full list of event types: https://developer.mozilla.org/en-US/docs/Web/API/document.createEvent

var event = document.createEvent(‘HTMLEvents’);
event.initEvent(‘change’, true, false);
el.dispatchEvent(event);

$(el).on(eventName, eventHandler);

el.addEventListener(eventName, eventHandler);

$(el).off(eventName, eventHandler);

el.removeEventListener(eventName, eventHandler);

var request = new XMLHttpRequest();
request.open(‘GET’, ‘/my/url’, true);

request.onreadystatechange = function() {
if (this.readyState === 4) {
if (this.status >= 200 && this.status < 400) {
// Success!
var resp = this.responseText;
} else {
// Error :(
}
}
};

request.send();
request = null;