JSFiddle

  • How old will I be in the year ___?

    jQuery 1.9.1, HTML, CSS, JavaScript, jQuery UI 1.9.2

    function calc() {
    	var inpBirth = $('.inp-birth').val().trim().match(/[1-9][0-9]*/),
    		inpYear = $('.inp-year').val().trim().match(/(-0*)?[1-9][0-9]*/),
    		willbe = '', msg ...
  • Prime Numbers

    jQuery 1.9.1, HTML, CSS, JavaScript

    function isPrime(n){
    	if (n <= 1) return false;
    	else if (n <= 3) return true;
    	else if (!(n%2) || !(n%3)) return false;
    	var i = 5;
    	while (i*i <= n) {
    		if (!(n%i) || !((i+2)%2)) return false;
    		i += 6;
    	}
    	return true;
    }
    
    $('input').on('change', function(e) {
    	var n = parseFloat($(this).val()),
    		p = isPrime(n),
    		t = p ? '' : '<span>NOT</span> ',
    		str = 'is {n}Prime'.replace(/\{n\}/, t);
    	$('div').html(str)
    });
    
    var ii = 5e5,
    	primes ...</=>
  • SO Help: Show page scroll only in fullscreen mode

    http://stackoverflow.com/questions/41856607/show-page-scroll-only-in-fullscreen-mode

    // add/remove no scroll class to body
    function toggleNoScroll(off) {
    	//	test if already exist:
    	var a = Array.prototype.indexOf.call ...
  • Hashtag Maker

    jQuery 1.9.1, HTML, CSS, JavaScript

    $(document)
    	.on('focus', 'textarea[readonly]', function(e) { $(this).select(); })
    	.on('keyup', 'textarea:not([readonly])', function(e) {
    		$('textarea[readonly]').text( $.trim ...
  • String.randColorHex #2 is the latest revision

    https://github.com/JDMcKinstry/String.randColorHex

    ;(function() {	//	String.randColorHex	//	Returns Hex Color Code
    	var a = '0123456789ABCDEF'.split(''),
    		b = a.length;
    	function mathRand(min, max) { var r ...
  • Not So Simple jQuery Alpha Numeric Inputs

    https://github.com/JDMcKinstry/Simple-jQuery-Alpha-Numeric-Inputs/blob/master/jQuery.alphanumeric.ext.js

    ;(function($) {	//	$.inputAlphaNumeric	//	set first variable "initializeON" to bool to toggle on || off from document.ready
    	var initializeON = true;
    	
    	function __event ...
  • Simple jQuery Alpha Numeric Inputs #1 is the latest revision

    https://github.com/JDMcKinstry/Simple-jQuery-Alpha-Numeric-Inputs

    ;(function($) {
    	var regEx = {
    			alpha: new RegExp('[a-z]', 'i'),
    			numeric: new RegExp('[0-9]'),
    			alphanumeric: new RegExp('[a-z]|[0-9]', 'i')
    		}
    	function procInput ...
  • Ninja Type Fun

    Ninja Type Fun

    var obj = {  "a": "ki" ,"b": "lu" ,"c": "chi" ,"d": "zu" ,"e": "ke" ,"f": "ru" ,"g": "ji" ,"h": "to" ,"i": "me ...
  • Kids Corner: Touch n Color

    jQuery 1.9.1, HTML, CSS, JavaScript, jQuery UI 1.9.2

    ;(function() {	//	String.randColorHex	//	Echoes Hex Color Code
    	var a = '0123456789ABCDEF'.split(''),
    		b = a.length;
    	function mathRand(min, max) { var r ...
  • SO Help: addClass if else not working properly

    http://stackoverflow.com/questions/38923826/addclass-if-else-not-working-properly

    $(function() {
    	$(document).on('mouseenter mouseleave', '.white_square', function(e) {
        var val = $('[name=color]').val(),
            cls = val == 'black-white' ? 'black_square' : 'colored_square';
        $(this).removeClass ...