Set Attribute

2 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€84.80
List Price:  €118.72
You save:  €33.92
£73.15
List Price:  £102.41
You save:  £29.26
CA$136.68
List Price:  CA$191.36
You save:  CA$54.67
A$143
List Price:  A$200.20
You save:  A$57.20
S$127.14
List Price:  S$178
You save:  S$50.86
HK$781.15
List Price:  HK$1,093.65
You save:  HK$312.49
CHF 77.69
List Price:  CHF 108.77
You save:  CHF 31.08
NOK kr967.15
List Price:  NOK kr1,354.05
You save:  NOK kr386.90
DKK kr633.35
List Price:  DKK kr886.72
You save:  DKK kr253.36
NZ$165.87
List Price:  NZ$232.22
You save:  NZ$66.35
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,214.06
List Price:  ৳17,100.18
You save:  ৳4,886.11
₹9,025.73
List Price:  ₹12,636.38
You save:  ₹3,610.65
RM393.21
List Price:  RM550.51
You save:  RM157.30
₦138,728.12
List Price:  ₦194,224.92
You save:  ₦55,496.80
₨27,951.71
List Price:  ₨39,133.51
You save:  ₨11,181.80
฿3,156.95
List Price:  ฿4,419.85
You save:  ฿1,262.90
₺4,348.14
List Price:  ₺6,087.57
You save:  ₺1,739.43
B$522.81
List Price:  B$731.96
You save:  B$209.14
R1,598.76
List Price:  R2,238.33
You save:  R639.57
Лв165.80
List Price:  Лв232.13
You save:  Лв66.32
₩144,844.20
List Price:  ₩202,787.68
You save:  ₩57,943.47
₪308.99
List Price:  ₪432.60
You save:  ₪123.60
₱5,910
List Price:  ₱8,274.24
You save:  ₱2,364.23
¥15,584.92
List Price:  ¥21,819.52
You save:  ¥6,234.59
MX$1,730.78
List Price:  MX$2,423.16
You save:  MX$692.38
QR363.42
List Price:  QR508.80
You save:  QR145.38
P1,322.22
List Price:  P1,851.16
You save:  P528.94
KSh12,898.71
List Price:  KSh18,058.71
You save:  KSh5,160
E£4,694.52
List Price:  E£6,572.51
You save:  E£1,877.99
ብር15,502.71
List Price:  ብር21,704.42
You save:  ብር6,201.70
Kz91,219.87
List Price:  Kz127,711.47
You save:  Kz36,491.60
CLP$86,330.36
List Price:  CLP$120,865.96
You save:  CLP$34,535.60
CN¥693.70
List Price:  CN¥971.20
You save:  CN¥277.50
RD$6,347.79
List Price:  RD$8,887.16
You save:  RD$2,539.37
DA12,995.80
List Price:  DA18,194.64
You save:  DA5,198.84
FJ$220.10
List Price:  FJ$308.15
You save:  FJ$88.05
Q766.59
List Price:  Q1,073.25
You save:  Q306.66
GY$20,909.94
List Price:  GY$29,274.76
You save:  GY$8,364.81
ISK kr12,296.77
List Price:  ISK kr17,215.97
You save:  ISK kr4,919.20
DH916.77
List Price:  DH1,283.52
You save:  DH366.74
L1,682.77
List Price:  L2,355.95
You save:  L673.17
ден5,226.90
List Price:  ден7,317.88
You save:  ден2,090.97
MOP$804.27
List Price:  MOP$1,126.01
You save:  MOP$321.74
N$1,600.79
List Price:  N$2,241.17
You save:  N$640.38
C$3,678.21
List Price:  C$5,149.64
You save:  C$1,471.43
रु14,704.79
List Price:  रु20,587.29
You save:  रु5,882.50
S/336.45
List Price:  S/471.05
You save:  S/134.59
K428.19
List Price:  K599.48
You save:  K171.29
SAR374.94
List Price:  SAR524.94
You save:  SAR149.99
ZK1,961.36
List Price:  ZK2,745.98
You save:  ZK784.62
L432.04
List Price:  L604.88
You save:  L172.83
Kč2,062.86
List Price:  Kč2,888.09
You save:  Kč825.23
Ft32,289.72
List Price:  Ft45,206.90
You save:  Ft12,917.18
SEK kr892.23
List Price:  SEK kr1,249.16
You save:  SEK kr356.92
ARS$144,835.52
List Price:  ARS$202,775.52
You save:  ARS$57,940
Bs696.40
List Price:  Bs975
You save:  Bs278.59
COP$362,990.69
List Price:  COP$508,201.49
You save:  COP$145,210.80
₡49,635.87
List Price:  ₡69,492.20
You save:  ₡19,856.33
L2,640.54
List Price:  L3,696.86
You save:  L1,056.32
₲663,066.42
List Price:  ₲928,319.51
You save:  ₲265,253.09
$U3,854.56
List Price:  $U5,396.54
You save:  $U1,541.97
zł357.81
List Price:  zł500.96
You save:  zł143.14
Already have an account? Log In

Transcript

Hello, in this jQuery video, I am going to show you how to set an attribute. So here we've got code how to get an attribute. So you have some sort of selector, and this was selected that you want to dot att RG short for attribute, then you put the name of the attribute in there, and that returned value. But what happens is, if we were to do this instead, per comma, then something else, this will actually set it. So if there's only one parameter, you'll return the value for this attribute. If there's two parameters, the first one will again just be the name or like the exact attribute, and then the second value will be the value that you assign to it.

So if we have a look, we've got a total of Hello, world. And I'm actually just going to create a proton. Let me Honestly, all I have to do, ID, you know, save that in the JavaScript file. I selected some dollar hash. I covered some of the events such as click yet, but we've covered selectors, and I'll be covering all this in a separate video function. So we are going to run this code and this code is just going to be this.

It is simply going to change the actual view the title attribute of every div which in this case is only the one and only To change it to epic. So if I save that if I go to elements go to body, it says hello world, everything saved, reload, go by. Okay, that's a total of hello world for click it. As you can see it's changed to Epic depth. So that's how you change the attribute of a HTML element using jQuery. Really simple.

One parameter just gets the value of the attribute, two parameters, set the value of that attribute. Simple is a lemon squeezy. If you have any questions, feel free to shoot me a message and I look forward to seeing you in the next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.