Top add

Showing posts with label jquery. Show all posts
Showing posts with label jquery. Show all posts

Jquery to read from xml

  1. Include the jquery in your page
  2. Validate the xml using online xml validators
  3. Use the jquery.get() to get all the data from the xml
    example:
    $('Contact',xml).each(function() {
    srno = parseInt($(this).find("srno").text());
    empId = $(this).find("empid").text();
    name = $(this).find("name").text();
    contact = $(this).find("contact-data").text();
    type = $(this).find("type").text(); }

  4. The xml data are read and shown as html using jquery
  5. To add new date use the function $('#idSave').click() to delete use deleteRow and to edit editrow
Download the source file here . Files has custom.js which has add/edit and delete function . Please run contact.html to see the output



el. is not a function in joomla


Suppose you are using mootools and jquery in joomla means you will get this error. To clear this error simple use jquery noconflict()



Jquery 1.5 deferred function

Jquery 1.5 has been released on 31st January. If includes existing bug fixing and ajax improvements. New methods Deferred is been introduced in 1.5

Deferred :

This function can be used in place for ajax. Suppose if we want to call a settimeout means we should manually call the javascript function. Now we can use this function

Example for settimeout:
$.wait = function(time) {
return $.Deferred(function(dfd) {
setTimeout(dfd.resolve, time);
});
}

jQuery’s serialize method?

All elements are retrieved in standard URL retrieval  method. Jquery has a option to serialize all the post values that are sent in form action.

Example :

<form action="#" id="input_form">
First name: <input name="first_name" type="text" />
Last name: <input name="last_name" type="text" />
Email: <input name="email" type="text" />
<input name="submit" type="submit" value="send" />
</form>

All the values that are submitted are retrieved using the jquery function $(this).serialize();

eg: var query_srting = $(this).serialize();

jQuery plugin: Easy Accordion

Nice and Easy Accordion menu can be mabde from jquery  You can then decide to make it a timed slideshow or leave it stil

it’s opensource and fully customizable and, what count most, it’s free! And it has been tested on Firefox 3.5+, IE6/7/8, Safari 5+ and Google Chrome.
  • Less than 8KB!
  • Decide whether or not automatically animate your slider
  • Insert multiple instances of the accordion in the same page
  • Set the active slide when the user loads the page
  • Easily create a nice and smooth accordion effect
  • Include or remove the slide number
  • Text is rotated using CSS properties. No need for images!
  • Accessible and SEO friendly
  • Slide any kind of content (divs, simple text, images, lists, etc.)