Code | Description | Example |
attr(name) | Obtains the value assigned to the specified attribute for the first element in the matched set | $('#myImage').attr('title'); |
attr(name,value) | Sets the named attribute to the passed value for all elements in the wrapped set. | $('#myImage').attr('title','This is titile.'); |
attr(attributes) | Uses the properties and values specified by the passed object to set corresponding attributes onto all element of the matched set. | $('myImage').attr({title:'This is title,alt:'This is alt''}) |
removeAttr(name) | Removes the specified attribute from every matched element. | |
data(name,value) | Adds the passed value to the jQuery-managed data store for all wrapped elements.(Returns a wrapped set) | |
data(name) | Retrieves any previously stored data with the specified name on the first element of the wrapped set. | |
removeData(name) | Removes any previously stored data with the specified name on all elements of the wrapped set. | |
addClass(names) | ||
removeClass(names) | ||
toggleClass(names) | Adds the specified class name if it doesn't exists on an element, or removes the name from elements that already possess the class name.Note that each element is tested individually,so some elements may have the class name added,and others may have it removed. Yes.this funtion() is fit for the list when you move your mouse on and mouse out. | |
toggleClass(name,switch) | ||
hasClass(name) | ||
css(name,value) | ||
css(properties) | ||
width(value)||height(value) | $('div.myElements').width(500); | |
offset() | ||
position() |
Attention1:
When we want to set element in disable state,we often use of the attr() method like this:
$('form').submit(function{
$(':submit',this).attr('disabled','disabled')
})
Attention2:
I think that data() and removeData() function like request.setAttribute() and request.getAttribute();