very simple question! i was wondering how to use javascript to alert something in my textbox…not sure what i’m doing now is not working. heres the function
function alertNow(comment){
alert(comment);
}
now here is the textbox
<input type = 'text' name = 'txt_comment'>
<button onClick = alertNow(txt_comment.value) value = "Submit Comment"></button>
sure this is doable, i did it before but i just forgot some syntax prob. any ideas? thanks!
You are missing quotations. Also use the ID instead of name.
Also better to use, document.getElementById like below