Change Input field text

Change Input field text then I need to change Title...

Demo

Hello Dear



HTML

    <h3>Hello Dear</h3>
    <input type="text" id="inputField"/>
    <button onClick="changeInputFieldText()">Submit</button>

Javascript

    function changeInputFieldText() {
        if ($("#inputField").val() == "Games") {
            $("h3").replaceWith('<h3>I love Games</h3>');
        } else {
            $("h3").replaceWith('<h3>Why not "Games"?</h3>');
        };
    };
  • Share
  • Copyright 2016 by WebiBeris.com. All Rights Reserved.