In this article I will collect useful tricks that I encountered during development of my Adnroid application with jQuery Mobile and Cordova.

Callbacks in separate methods

You could prefer to process events in separate methods, but it was a bit tricky for me to realise how to pass existing method as callback. Ugly realization was:

$( "#select_id" ).select( function () { myMethod(); } )

It works, but you will it is less readable because of anonimous function. So better realization was to pass name of the method.

$( "#select_id" ).select( myMethod )

Naming conventions

This is common for most programming languages, but it's really important to follow this rule in Javascript: do not use variable names, that differ only by one letter i.e. data and date.

Javascript will interpret this and it will be hard to find where error is, because there are no messages in log or in your IDE.

Way to get day of month from Date object

I don't know why is this so, but method getDay() will return current day of week, so you should use getDate() to get day of month.