Why my delete button doesn't work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
19th Jul 2018, 8:43 AM
Sina
Sina - avatar
9 Answers
+ 2
If you want to write it in your way this is how you can do it. https://code.sololearn.com/Wd4oaoJJHH3Y/?ref=app
19th Jul 2018, 9:12 AM
Tim Thuma
Tim Thuma - avatar
+ 5
get the element itself not its value https://code.sololearn.com/WWTi509CTQQ8/?ref=app
19th Jul 2018, 8:53 AM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 4
Sina you really have to know how objects work. you are getting the elements content (string) not the element itself (object). those are two different things. even in Tim Thuma example,he had to assign variable y to the object itself..again. ¯\_(ツ)_/¯
19th Jul 2018, 10:56 AM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 3
I don't know for sure, but if I guess I think it's because 'getElementById().value' is only for getting the value, not assigning so you have to do it like 'y.value = str' to assign values.
19th Jul 2018, 10:08 AM
Tim Thuma
Tim Thuma - avatar
+ 1
Thnak you so much
19th Jul 2018, 9:59 AM
Sina
Sina - avatar
0
if I get just the element it will errors
19th Jul 2018, 8:59 AM
Sina
Sina - avatar
0
I can write my code in your way but I want to write it in my way
19th Jul 2018, 9:00 AM
Sina
Sina - avatar
0
Can you tell me the reason plz
19th Jul 2018, 10:03 AM
Sina
Sina - avatar
0
whsn I write x = str it doesn't work but when I write y.value = str it works
19th Jul 2018, 10:04 AM
Sina
Sina - avatar