jquery Programming Glossary: i.test
using the jquery validation plugin, how can I add a regex validation on a textbox? http://stackoverflow.com/questions/1053618/using-the-jquery-validation-plugin-how-can-i-add-a-regex-validation-on-a-textbo value element return this.optional element ^ a z0 9 i.test value Username must contain only letters numbers or dashes...
How can I detect AJAX node insertion without using DOM mutation events? http://stackoverflow.com/questions/10664669/how-can-i-detect-ajax-node-insertion-without-using-dom-mutation-events UserScript function highlightGoodComments jNode if beer i.test jNode.text jNode.css background yellow waitForKeyElements #userBlather..
How to get an AJAX get-request to wait for the page to be rendered before returning a response? http://stackoverflow.com/questions/11486256/how-to-get-an-ajax-get-request-to-wait-for-the-page-to-be-rendered-before-return @grant GM_addStyle UserScript if fiddle .jshell .net i.test location.host console.log Master page start... Inform the user...
Detecting if a device is able to change orientation in JavaScript http://stackoverflow.com/questions/13803838/detecting-if-a-device-is-able-to-change-orientation-in-javascript this question Detecting mobile devices 1 if mobile i.test navigator.userAgent ... Simple browser sniffing 2 jQuery.browser.mobile..
jQuery plugin to serialize a form and also restore/populate the form? http://stackoverflow.com/questions/1489486/jquery-plugin-to-serialize-a-form-and-also-restore-populate-the-form if this.name this.disabled this.checked select textarea i.test this.nodeName text hidden password i.test this.type data.. textarea i.test this.nodeName text hidden password i.test this.type data this.name this .val return data else .each..
jquery .animate periodocially not running http://stackoverflow.com/questions/14996012/jquery-animate-periodocially-not-running if Android webOS iPhone iPad iPadMini iPod BlackBerry i.test navigator.userAgent console.log here var maxTime 1000 allow..
Disable jQuery for mobile devices http://stackoverflow.com/questions/17104469/disable-jquery-for-mobile-devices var isMobile Android webOS iPhone iPad iPod BlackBerry i.test navigator.userAgent true false '.inner slide' .click function..
Modify jQuery autocomplete not to submit eagerly on Enter http://stackoverflow.com/questions/18749924/modify-jquery-autocomplete-not-to-submit-eagerly-on-enter restore the input to it's initial state. if ^destroy i.test arguments 0 Attach event to the input which will prevent Enter..
jquery validate plugin not working on blur of the fields http://stackoverflow.com/questions/20856925/jquery-validate-plugin-not-working-on-blur-of-the-fields value element return this.optional element ^ a zA Z' s i.test value Please enter Alphabetic or apostrophe ' only. Now the..
Validating url with jQuery without the validate-plugin? http://stackoverflow.com/questions/2723140/validating-url-with-jquery-without-the-validate-plugin a z d . _ ~ u00A0 uD7FF uF900 uFDCF uFDF0 uFFEF da f 2 ' @ i.test myVariable alert valid url else alert invalid url This handles..
jquery on blur validation http://stackoverflow.com/questions/4263984/jquery-on-blur-validation element ^ a zA Z0 9._ @ a zA Z0 9 . a zA Z. 2 5 i.test value Please enter a valid email address. .validator.addMethod.. element return this.optional element ^ a zA Z0 9._ 3 16 i.test value Username are 3 15 characters .validator.addMethod password.. return this.optional element ^ A Za z0 9 @# ^ _ 6 16 i.test value Passwords are 6 16 characters Validate signup form #signup..
CSS3 - Style radio inputs using the :checked selector on older browsers (ie7/ie8) http://stackoverflow.com/questions/7461756/css3-style-radio-inputs-using-the-checked-selector-on-older-browsers-ie7-ie8 has a name or not a name attribute is required if label i.test this .next 0 .tagName this.name Adds an onchange event handler..
jQuery custom background through a cookie http://stackoverflow.com/questions/7545691/jquery-custom-background-through-a-cookie JavaScript code. function images which var image ^t d i.test which images which.substr 1 1 null if image null .cookie html_img..
Listening for Youtube Event in JavaScript or jQuery http://stackoverflow.com/questions/7988476/listening-for-youtube-event-in-javascript-or-jquery id var elem document.getElementById id if elem if ^iframe i.test elem.tagName return id Frame OK else Look for frame var elems.. 0 i elems.length i if ^https www . youtube nocookie .com i.test elems i .src break elem elems i The only or the best iFrame..
How to check if a string is a valid hex color representation? http://stackoverflow.com/questions/8027423/how-to-check-if-a-string-is-a-valid-hex-color-representation share improve this question var isOk ^# 0 9A F 6 i.test '#aabbcc' and more advanced var isOk ^# 0 9A F 6 ^# 0 9A F 3.. and more advanced var isOk ^# 0 9A F 6 ^# 0 9A F 3 i.test '#ac3' for #f00 Thanks Smamatti share improve this answer..
using the jquery validation plugin, how can I add a regex validation on a textbox? http://stackoverflow.com/questions/1053618/using-the-jquery-validation-plugin-how-can-i-add-a-regex-validation-on-a-textbo want to validate function .validator.addMethod loginRegex function value element return this.optional element ^ a z0 9 i.test value Username must contain only letters numbers or dashes. #signupForm .validate rules login required true loginRegex..
How can I detect AJAX node insertion without using DOM mutation events? http://stackoverflow.com/questions/10664669/how-can-i-detect-ajax-node-insertion-without-using-dom-mutation-events https gist.github.com raw 2625891 waitForKeyElements.js UserScript function highlightGoodComments jNode if beer i.test jNode.text jNode.css background yellow waitForKeyElements #userBlather div.comment highlightGoodComments share improve..
How to get an AJAX get-request to wait for the page to be rendered before returning a response? http://stackoverflow.com/questions/11486256/how-to-get-an-ajax-get-request-to-wait-for-the-page-to-be-rendered-before-return @require https gist.github.com raw 2625891 waitForKeyElements.js @grant GM_addStyle UserScript if fiddle .jshell .net i.test location.host console.log Master page start... Inform the user. #plainResults .before ' div id gmFetchRez Greasemonkey..
Detecting if a device is able to change orientation in JavaScript http://stackoverflow.com/questions/13803838/detecting-if-a-device-is-able-to-change-orientation-in-javascript device orientation orientation changes share improve this question Detecting mobile devices 1 if mobile i.test navigator.userAgent ... Simple browser sniffing 2 jQuery.browser.mobile plug in exhaustive browser sniffing 3 if 'ontouchstart'..
jQuery plugin to serialize a form and also restore/populate the form? http://stackoverflow.com/questions/1489486/jquery-plugin-to-serialize-a-form-and-also-restore-populate-the-form data 'object' return all data data .each els function if this.name this.disabled this.checked select textarea i.test this.nodeName text hidden password i.test this.type data this.name this .val return data else .each els function if.. els function if this.name this.disabled this.checked select textarea i.test this.nodeName text hidden password i.test this.type data this.name this .val return data else .each els function if this.name data this.name if this.type 'checkbox'..
jquery .animate periodocially not running http://stackoverflow.com/questions/14996012/jquery-animate-periodocially-not-running jQuery window .on 'swipeBackward' swipeHandlerPrev if Android webOS iPhone iPad iPadMini iPod BlackBerry i.test navigator.userAgent console.log here var maxTime 1000 allow movement if 1000 ms 1 sec maxDistance 50 swipe movement of 50..
Disable jQuery for mobile devices http://stackoverflow.com/questions/17104469/disable-jquery-for-mobile-devices you just give those elements a class I'm going for .inner slide var isMobile Android webOS iPhone iPad iPod BlackBerry i.test navigator.userAgent true false '.inner slide' .click function e if isMobile e.preventDefault dataslide this .attr 'data..
Modify jQuery autocomplete not to submit eagerly on Enter http://stackoverflow.com/questions/18749924/modify-jquery-autocomplete-not-to-submit-eagerly-on-enter return function If the first argument isn't destroy which should restore the input to it's initial state. if ^destroy i.test arguments 0 Attach event to the input which will prevent Enter submission as explained above. this.keypress cancelAutocompleteSumbission..
jquery validate plugin not working on blur of the fields http://stackoverflow.com/questions/20856925/jquery-validate-plugin-not-working-on-blur-of-the-fields js file jQuery.validator.addMethod aplhawithaposonly function value element return this.optional element ^ a zA Z' s i.test value Please enter Alphabetic or apostrophe ' only. Now the page is getting validated only on submit of the form. But I..
Validating url with jQuery without the validate-plugin? http://stackoverflow.com/questions/2723140/validating-url-with-jquery-without-the-validate-plugin uD7FF uF900 uFDCF uFDF0 uFFEF da f 2 ' @ uE000 uF8FF # a z d . _ ~ u00A0 uD7FF uF900 uFDCF uFDF0 uFFEF da f 2 ' @ i.test myVariable alert valid url else alert invalid url This handles unicode etc so it's a bit verbose. Source is the same as..
jquery on blur validation http://stackoverflow.com/questions/4263984/jquery-on-blur-validation .validator.addMethod email function value element return this.optional element ^ a zA Z0 9._ @ a zA Z0 9 . a zA Z. 2 5 i.test value Please enter a valid email address. .validator.addMethod username function value element return this.optional element.. email address. .validator.addMethod username function value element return this.optional element ^ a zA Z0 9._ 3 16 i.test value Username are 3 15 characters .validator.addMethod password function value element return this.optional element ^ A.. characters .validator.addMethod password function value element return this.optional element ^ A Za z0 9 @# ^ _ 6 16 i.test value Passwords are 6 16 characters Validate signup form #signup .validate rules email required email username required..
CSS3 - Style radio inputs using the :checked selector on older browsers (ie7/ie8) http://stackoverflow.com/questions/7461756/css3-style-radio-inputs-using-the-checked-selector-on-older-browsers-ie7-ie8 if the next element is a label and whether the RADIO element has a name or not a name attribute is required if label i.test this .next 0 .tagName this.name Adds an onchange event handler to the RADIO input element THIS FUNCTION will ONLY run if..
jQuery custom background through a cookie http://stackoverflow.com/questions/7545691/jquery-custom-background-through-a-cookie converted your code to a more efficient and syntactically valid JavaScript code. function images which var image ^t d i.test which images which.substr 1 1 null if image null .cookie html_img image expires 7 else image .cookie html_img if image image..
Listening for Youtube Event in JavaScript or jQuery http://stackoverflow.com/questions/7988476/listening-for-youtube-event-in-javascript-or-jquery function for an easier implementation function getFrameID id var elem document.getElementById id if elem if ^iframe i.test elem.tagName return id Frame OK else Look for frame var elems elem.getElementsByTagName iframe if elems.length return null.. elems.length return null No iframe found FAILURE for var i 0 i elems.length i if ^https www . youtube nocookie .com i.test elems i .src break elem elems i The only or the best iFrame if elem.id return elem.id Existing ID return it else Create..
How to check if a string is a valid hex color representation? http://stackoverflow.com/questions/8027423/how-to-check-if-a-string-is-a-valid-hex-color-representation invalid hex color has extra characters javascript jquery colors share improve this question var isOk ^# 0 9A F 6 i.test '#aabbcc' and more advanced var isOk ^# 0 9A F 6 ^# 0 9A F 3 i.test '#ac3' for #f00 Thanks Smamatti share improve this..
|