+ 3

What does the val() do in this code?

I don't know what the val() means here. $(function() { $("#name").keydown(function() { $("#msg").html($("#name").val()); }); })

20th Jul 2017, 2:26 PM
DeltaTick
DeltaTick - avatar
2 Respostas
+ 13
Gets the value of input with id "name" and assigns it to the element with id "msg".... (val() is used for inputs, html() is used for all other elements...)
20th Jul 2017, 2:32 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 3
(val also used for textarea element)
20th Jul 2017, 3:36 PM
Yanothai Chaitawat
Yanothai Chaitawat - avatar