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”