My jquery code is now starting to create some pretty long lines of code espically with some of the regex strings. What is the best way to wrap lines of code within your Jquery syntax so that it is easier to read ?
Thanks,
My jquery code is now starting to create some pretty long lines of code espically with some of the regex strings. What is the best way to wrap lines of code within your Jquery syntax so that it is easier to read ?
Thanks,
When dealing with strings you can use concatenation (+) or the backslash (\):
http://www.developfortheweb.com/2009/03/multi-line-strings-in-javascript/
For RegExp you can create them as objects, but you'll need to escape all backslashes.
var REGEX = new RegExp("^\\/[0-9]{1,2}$|^255\\.255\\.255\\.0$");
$("#input6").blur(function() { var REGEX = /^\/[0-9]{1,2}$|^255\.255\.255\.0$/;