Set the width attribute of an image:
The attr() method sets or returns attribute values of selected elements.
This method works differently depending on the parameters.
Return the value of an attribute for the selected element.
| Parameter | Description |
|---|---|
| attribute | Specifies the attribute to get the value of |
Set the attribute and value of the selected elements.
| Parameter | Description |
|---|---|
| attribute | Specifies the name of the attribute |
| value | Specifies the value of the attribute |
Using a function to set the attribute value for the selected elements.
| Parameter | Description |
|---|---|
| attribute | Specifies the name of the attribute |
| function(index,oldvalue) | Specifies a function that returns the attribute value to
set.
|
Set one or more attributes and values for the selected elements.
| Parameter | Description |
|---|---|
| {attribute:value, attribute:value, ...} | Specifies one or more attribute/value pairs |
| WEB HOSTING |
|---|
| Best Web Hosting |
| PHP MySQL Hosting |
| Best Hosting Coupons |
| UK Reseller Hosting |
| Cloud Hosting |
| Top Web Hosting |
| $3.98 Unlimited Hosting |
| Premium Website Design |
| WEB BUILDING |
|---|
| XML Editor - Free Trial! |
| FREE Website BUILDER |
| Best Website Templates Top CSS Templates |
| CREATE HTML Websites |
| EASY WEBSITE BUILDER |
| W3SCHOOLS EXAMS |
|---|
|
Get Certified in: HTML, CSS, JavaScript, XML, PHP, and ASP |
| W3SCHOOLS BOOKS |
|---|
|
New Books: HTML, CSS JavaScript, and Ajax |
| STATISTICS |
|---|
|
Browser Statistics Browser OS Browser Display |
| SHARE THIS PAGE |
|---|