How can I get element via javascript??

            <script language="javascript">
                  function GetString()
                        var add = document.getElementById("byStr");
                                add += "World";
            <input type="text" id="btStr" value="Hello"/>
            <input type="button" id="btOK" value="OK" onclick="GetString()"/>


I click the button but nothing happen.
I want the text expose "Hello World" after click the button
Who is Participating?
RimvisConnect With a Mentor Commented:
You have a typo in your code
var add = document.getElementById("byStr");
should be
 var add = document.getElementById("btStr");

tatamaruriAuthor Commented:
IT is stupid mistake
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.