Skip to main content

Posts

Showing posts with the label jquery

iPhone Web Application with jQuery

http://www.jqtouch.com http://developer.apple.com/safari/library/navigation/index.html http://iphone.hohli.com http://www.leapbeyond.com/ric/scuba/appletdemo/FullScreenMap.htm http://econym.org.uk/gmap/example_fullscreen1.htm

Tooltip callback

jQUERY TOOLTIP callback $(".pickdrop").tooltip({ bodyHandler: function() { var div = $(this); var divd = "#"+div.attr("id") +"d"; if ($(divd).html()!='') return $(divd).html(); else { var result = $("<span/>").html("loading..."); var str = div.attr("name") orderId = str.substring(0, str.indexOf(":")); type = str.substring(str.indexOf(":")+1); $.get("yoururl.aspx?OrderId="+orderId+"&type="+type, function(data){ $(divd).html(data); result.html(data); }); return result; } }, delay: 0, showURL: false });

Jquery Phone Number validation

$.validator.addMethod("phone", function(ph, element) { if (ph == null) { return false; } var phoneRe = /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/; return phoneRe.test(ph); }, "Please enter a valid phone number");

Animate background with jQuery

example to Animate background with jQuery 1 currentID = Math.floor(Math.random()*imgs.length) 2 newImage = "url(" + imgs[currentID] + ")"; 3 $("#topdiv").animate({opacity: 'toggle'}, "slow", function () 4 { 5 document.getElementById('topdiv').style.backgroundImage = newImage; 6 $("#topdiv").animate({opacity: 'toggle'}, "slow"); 7 } 8 ); change div background document.getElementById('topdiv').style.backgroundImage = newImage;

validate email and phone number with Regular Expressions

Here is sample to validate Phone, Email, URL http://www.costudio.com/contactus.asp emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2} (comnetorgeduintmilgovarpabizaeronamecoopinfopromuseum))$/ phoneRe = /^((\+\d{1,3}(- )?\(?\d\)?(- )?\d{1,5})(\(?\d{2,6}\)?))(- )?(\d{3,4}) (-)?(\d{4})(( x ext)\d{1,5}){0,1}$/ http://javascript.about.com/library/blre.htm Jquery Validation http://bassistance.de/jquery-plugins/jquery-plugin-validation/