How to set and get Attributes in JQuery

Posted by Goud.Kv under jQuery category on | Points: 40 | Views : 538
Below code explains Setting and Getting attributes in JQuery.

var al = $("a#user").attr("href"); 

// obtaining href attribute value

$("a#user").attr("href", "");

// setting the href attribute to a new value

alt: "The Famous Search Engine",
href: ""
// can set more than one attribute to new values

Comments or Responses

Login to post response