Input only shows/retains the first word

Input only shows/retains the first word

thegamechangerprothegamechangerpro Posts: 81Questions: 30Answers: 1

Why is my input only showing the first word of the data?

https://jsfiddle.net/thegamechangerpro/bf8Lmpk1/10/

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,341Questions: 26Answers: 4,954
    edited March 2023 Answer ✓

    The problem is with how you have the double quotes. I find it easier to use single quotes for the string itself when you want double quotes to be within the string. I added a console log statement so you can see this. For example:

    <input type="text" value =Maria G>
    

    Since Maria G is not within quotes the HTML interpreter displays only Maria. You can inspect the input, in your test case, to see how the HTML is built.

    I updated the return statement to use single quotes.

    https://jsfiddle.net/fh901vea/

    Kevin

  • thegamechangerprothegamechangerpro Posts: 81Questions: 30Answers: 1

    Huh.

    Thanks so much! I usually do the same thing, but I pulled that bit of code from an example and left well enough alone.

    Thanks again!!!!

Sign In or Register to comment.