Get a DOM object from a JQuery obj
$('#' + id).get(0); //get the dom object from the jquery wrapper
Only include object if JQuery is available
//only include if jquery is available
if (typeof jQuery != 'undefined') {
//class goes here
}
Read more…
I’ve been trying to write my first JQuery plug in and went for a tree view because I need to display some nested data. Nothing complicated and more about trying to understand the JQuery plug in structure really. It’s pretty well commented so I won’t explain it
Read more…
I always have a unique id in my databases for each row. When passing this to objects for javascript to manipulate I add it to the class string as ‘id_1′ so I can easily retrieve it later. The GetIds function below returns an array with the id pulled out. It also handles multiple ids in the format of ‘id_name_1′ so we can do something like ‘block id_1 id_Page_1′
Read more…
Javascript can be used to check if an image exist. An AJAX call cannot be used, because cross-site calls are not supported. However, the javascript Image object can be used for this purpose.
var img = new Image();
<a href="http://www.fruitbatscode.com/javascript/check-if-an-image-exits#more-4" class="more-link">Read more...</a>