Posts Tagged ‘get value

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



Calendar

May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Blog Stats

  • 38,558 hits

Category