Lately I was working on a project based on PhoneGap. As you know PhoneGap utilises the HTML5 while taking advantage of the native features such as camera, accelerometer etc. The client came up with a odd idea, that when user clicks on an external URL, it should open in the browser else it should work […]
Force Text Input to Lower case using JavaScript
Sometimes its mandatory to get smaller case or uppercase user input from users. For example usually we don’t type email address in capital letters (even if we do, it’s not a crime). Let’s assume we have a text box as below Now using jQuery I’m gonna make sure that user will never enter CAPITAL letters […]
Simple basic Image Carousel with jQuery Mobile
There are good number of third party plugins that you can use with jQuery Mobile for this purpose. But I thought of showing off the simple way of doing the basic Image Carousel. First our html page would look like as below Header Then our JS would look like below. var i = 0; var […]
Write your first .net web service and consume it in jQuery Mobile
As usual, I thought of writing an absolute beginner level tutorial for jQuery Mobile & .net web service developers. First open the Visual Studio and create a Service. Visual Studio will create a service template with a name of Service1. Change the Hello world method in it as below using System; using System.Collections.Generic; using System.Linq; […]
Encode Colon “:”
If you use URIencode() method you will find that some special characters (, / ? : @ & = + $ #) including colon is not encoded to ‘%3A’. To overcome this issue, you should use encodeURIComponent() encodeURIComponent(‘:’);
Click Event for Collapsible Blocks in jQuery Mobile
I was trying to bind click event for Collapsible Blocks in jQuery Mobile as we do for buttons. But with latest framework update it was not working at all. Spend some time to figure out the events for Collapsible blocks. $(‘#my-collaspible’).bind(‘expand’, function () { alert(‘Expanded’); }).bind(‘collapse’, function () { alert(‘Collapsed’); });
JSON date string to Date Object using RegEx
JSON has become de-facto standard for web services. When you use JSON in web services the date is returned as some numbers. How to convert it to readable date format? Checkout the following code on how we utilise Regular Expression to tackle this.. var prettyDate = prettyDate(“/Date(1277334000000+0100)/”); alert(prettyDate); var prettyTime = prettyTime(“/Date(1277334000000+0100)/”); alert(prettyTime ); function […]
Submit PHP form without refreshing the page with jQuery and Ajax
There are so many tutorials on this topic but not a single one to get started for absolute beginners. Here comes the easy to understand tutorial 🙂 html form <html> <head> <title>Hello world</title> <script type="text/javascript" src="jquery-1.7.2.js"></script> <script type="text/javascript"> […]