26
Oct
09

common method used in website using jquery


These are  common methods that usually used in my websites using jquery

Get value of an id or class

$("#someid").val(); // to get value of an id
$(".someclass").val; // to get value of a class

Set value of an id or class

$("#someid").val("test"); // gving value test for an id
$(".someclass").val("class value"); // giving value for  class

Load page inside a div

$("#somediv").load("page.html"); // load page.html into a div with id somediv

Insert HTML text into div

$("#somediv").html("<strong>this text will appear bold</strong>");

Using Animation

$(".someclass").fadeOut(3000); // someclass will fade out in 3 seconds
$(".someclass").fadeIn(3000); // someclass will fade in in 3 seconds
$(".someclass").slideDown(3000);
$(".someclass").slideUp(3000);

Get value of tags attibute

$("a.someclass").attr("href"); // get value of href attribute

0 Responses to “common method used in website using jquery”



  1. Leave a Comment

Leave a comment


Calendar

October 2009
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  

Blog Stats

  • 38,558 hits

Category