0

See thsi code plz

https://code.sololearn.com/Wh8Xh32E6UdA/?ref=app it works correctly but when I write gthis.value = "Sina"; it doesn't work why?

25th Jul 2018, 12:47 PM
Sina
Sina - avatar
7 odpowiedzi
+ 2
Its correct and same here working for me too
25th Jul 2018, 2:16 PM
ᴋᵘⁿᵃˡ
ᴋᵘⁿᵃˡ - avatar
+ 1
It works for me?
25th Jul 2018, 12:51 PM
Andre Daniel
Andre Daniel - avatar
0
see the code again plz
25th Jul 2018, 4:47 PM
Sina
Sina - avatar
0
In your code's case, this. refers to the document(html, which has no variabke value), not the element. The element simply calls the function when you click it; it does not inherit the function.
25th Jul 2018, 5:42 PM
Andre Daniel
Andre Daniel - avatar
0
can you fix it plz
25th Jul 2018, 9:33 PM
Sina
Sina - avatar
0
Use what you previously had. document.getElementById("input").value = "Sina";
25th Jul 2018, 9:34 PM
Andre Daniel
Andre Daniel - avatar
0
you mean I can't use "this"??
25th Jul 2018, 10:02 PM
Sina
Sina - avatar