function my_function() { try { } catch(e1) { } }
All posts by
Alert Message Box
alert("Clicked!"); alert("Value is " + SomeVariable);
Detect press and hold of an element
var timeoutId = 0; $('#my_element').mousedown(function() { timeoutId = setTimeout(my_function, 1500); }).bind('mouseup mouseleave', function() { clearTimeout(timeoutId); });
Get Element By Id
document.getElementById("my_image").src="images/image2.png";
Changing Images In Javascript
Changing an image src Using jQuery to change an image src
Header
<div data-role="page" id="Page0" data-theme="a"> <div data-role="header" data-theme="a"> <h1>Page 0</h1> </div>
Setting Theme
Setting the theme for a page Use data-theme: <div data-role="page" id="Page2" data-theme="a"> Note that the headers and footers will still default to theme "a". To change them you need to specify data-theme="b" in the header and footer divs too. Setting Theme of An Element data-theme="a"
Where to include external script tags
With javascript it is usually best practice to avoid inserting external script tags inside the head from a performance perspective. However for jQuery Mobile moving the jQuery and jQuery Mobile scripts to the end of the HTML file may lead to your webapp being shown as plain HTML without CSS for some milliseconds until the […]
Page Size & Style
The viewport is the area in which the page fits. You can specify its width and height and it can be smaller or larger than the total visible area of the screen. The scale and zoom features of the mobile browser can be used to work aroudn this. A mobile-friendly website typically should start with […]
Slider Examples
Horizontal Sliders Creating a Volume Controller with jQuery UI Slider Vertical Sliders jQuery mobile vertical slider