How To Scroll to the Top of the Page using Javascript

Author: , March 20th, 2018

window.scrollTo(x-coord, y-coord); Example: window.scrollTo(0,0);

How To Fix WordPress 3.8 Bugs

Author: , January 29th, 2014

Edit the wp-config.php file in the root of your WordPress Install. Search for this line: require_once(ABSPATH . ‘wp-settings.php’); Just before it add this line: define(‘CONCATENATE_SCRIPTS’, false ); Save, exit and refresh the page in your browser. It would also be a good idea to empty your browser cache. Original Post:

How To Round And Format Numbers In JavaScript

Author: , September 23rd, 2012

1 2 3 4 5 var num = 10; var result = num.toFixed(2); // result will equal 10.00   var num= 170.2305; var result = num.toFixed(3); // result will equal 170.231 var num = 10; var result = num.toFixed(2); // result will equal 10.00 var num= 170.2305; var result = num.toFixed(3); // result will equal […]

How To Install LESSC Using node.js

Author: , April 26th, 2012

I did this as root. YMMV… gem uninstall less (just in case you used the old way…) git clone git:// (or use wget; tar xvzf node-*) cd node ./configure make make install cd .. curl | sh npm install less ln -s /usr/lib/nodejs/less/bin/lessc /usr/bin/lessc

How To Escape Newlines In PHP For Javascript

Author: , January 11th, 2012

You must use all three lines together for it to work…YMMV: 1 2 3 $escaped = str_replace(chr(10),’\n’,$original_value); $escaped = str_replace(chr(13),’\r’,$escaped); $escaped = preg_replace("/(\r?\n)/","\n",$escaped); $escaped = str_replace(chr(10),’\n’,$original_value); $escaped = str_replace(chr(13),’\r’,$escaped); $escaped = preg_replace(“/(\r?\n)/”,”\n”,$escaped);

How To Use Regular Expressions In JavaScript

Author: , November 3rd, 2011

RegExp.exec(string) Applies the RegExp to the given string, and returns the match information. 1 var match = /s(amp)le/i.exec("Sample text") var match = /s(amp)le/i.exec(“Sample text”) match then contains [“Sample”,”amp”] RegExp.test(string) Tests if the given string matches the Regexp, and returns true if matching, false if not. 1 var match = /sample/.test("Sample text") var match = /sample/.test(“Sample […]

How To Validate Passwords Using jQuery

Author: , October 19th, 2011

The ability to validate BEFORE a form is submitted greatly reduces end-user frustration by telling the user immediately what the issue is. The jQuery Validation plugin does just that. Here is a link to the plugin’s home page: This is a simple recipe for doing custom password validation: In the html head 1 2 […]

How To Use a Spinner With jquery.pager

Author: , September 26th, 2011

Just an addendum to the previous post about ajax loader spinner images… 1 2 3 jQuery(’.page-number, .pgNext:not(.pgEmpty)’).live("click", function (event) {      jQuery(’#Spinner’).fadeIn(); }); jQuery(‘.page-number, .pgNext:not(.pgEmpty)’).live(“click”, function (event) { jQuery(‘#Spinner’).fadeIn(); });

How To Implement A Very Simple Ajax Loader Using jQueryUI

Author: , September 23rd, 2011

GET Resources LOAD Resources 1 2 3 <LINK rel="stylesheet" HREF="/css/smoothness/jquery-ui-1.8.14.custom.min.css"> <script src="/js/jquery-1.6.4.min.js"></script> <script src="/js/jquery-ui-1.8.16.custom.min.js"></script> <LINK rel=”stylesheet” HREF=”/css/smoothness/jquery-ui-1.8.14.custom.min.css”> <script src=”/js/jquery-1.6.4.min.js”></script> <script src=”/js/jquery-ui-1.8.16.custom.min.js”></script> HTML Substitute your own loader graphic from 1 2 3 4 5 6 <img      src="//"      alt="Please wait…"      class="Spinner hidden"      id="Spinner-first" /> <img src=”//” […]

How To Redirect To A New Page After A Delay Using Javascript

Author: , August 16th, 2011

1 2 3 setTimeout(function() {      window.location.href = "/index.html"; }, 4000); setTimeout(function() { window.location.href = “/index.html”; }, 4000);