Javascript – Current date with format yyyy-mm-dd hh:MM:ss
function NOW() { var date = new Date(); var aaaa = date.getFullYear(); var gg = date.getDate(); var mm = (date.getMonth() + 1); if (gg < 10) gg = “0” + gg; if (mm < 10)…
function NOW() { var date = new Date(); var aaaa = date.getFullYear(); var gg = date.getDate(); var mm = (date.getMonth() + 1); if (gg < 10) gg = “0” + gg; if (mm < 10)…
Supported by all modern browser and IE9+. var callback = function() { // Handler when the DOM is fully loaded }; if (document.readyState === “complete” || (document.readyState !== “loading” && !document.documentElement.doScroll) ) { callback(); }…
How remove whitespace from both sides of a string (trim function): Pure Javascript var mystring = ” dotmaui.com “; mystring.trim(); For browsers that do not support the trim() method: String.prototype.trim = function() {…
function isInt(value) { return !isNaN(value) && parseInt(Number(value)) == value && !isNaN(parseInt(value, 10)); } Tests: isInt(7) // true isInt(“7”) // true isInt(7e5) // true isInt(“7e7″) // true isInt(” 7 “) // true isInt(“”) // false isInt(“…
To make JS Minify more and more complete, we started implementing some options. Version 1.3.2 provides: remove unreachable code drop unreferenced functions and variables join consecutive var statements preserve comments discard calls to console.* functions…
jQuery is a great JavaScript Library, it helps to write less and simplifies JavaScript programming But often there is no need to include jQuery, because the necessary functions are few. It might be fun and useful…
Here is a small function to get the value of a selected radio button without using jQuery: function getRadioValue(name) { var radios = document.getElementsByName(name); for (var i = 0; i< radios.length; i++) { if (radios[i].checked)…
Minimize javascript from an url with the .Maui APIs in PHP is quick, easy and free. You can choose between two compression levels: High, no readability, smallest size, or bass, higher readability. You can also…