javascript value property dose not working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

javascript value property dose not working?

name : <input id= "myText" type="text" value= "mickey"> <p>Click to change the value </p> <button onclick="myFunciton()"> try it</button> <script type="text/javascript"> function myFunciton(){ var x = document.getElementById("myText"); x.value("jewel"); } </script>

24th Feb 2020, 9:46 AM
Ibrahim Hossain
Ibrahim Hossain - avatar
5 Answers
+ 1
well as the error said, its not a function try x.value = "jewel"
24th Feb 2020, 9:50 AM
Taste
Taste - avatar
0
showed into the console panel. index.html:16 Uncaught TypeError: x.value is not a function at myFunciton (index.html:16) at HTMLButtonElement.onclick (index.html:12)
24th Feb 2020, 9:47 AM
Ibrahim Hossain
Ibrahim Hossain - avatar
0
Please link your code here
24th Feb 2020, 10:32 AM
JS LOVER
JS LOVER - avatar
0
Thank you teste! you are right
24th Feb 2020, 11:40 AM
Ibrahim Hossain
Ibrahim Hossain - avatar
0
actually when i am practicing the code segment that time occured the error.
24th Feb 2020, 11:42 AM
Ibrahim Hossain
Ibrahim Hossain - avatar