-1

HTML // code

input id ="submit_btn" type="submit" value="find" onclick="goto();"

Javascript / code

 function goto()
    {
        if (document.getElementById("s_keyword").value != "") {
            var url = ("https://www.youtube.com/results?search_query=" + document.getElementById("s_keyword").value);
            var site = window.open(url, '_blank');
            site.focus();
        }
    };  

it never enters into goto function !

Ahmed Mohsen
  • 114
  • 2
  • 9
  • Regarding the duplicate, see "Inline event listeners" in the accepted answer: "*` – apsillers Jul 16 '14 at 22:25

1 Answers1

2

Chrome extensions don't support inline events. Add the event listener in your JavaScript, and it'll be fine:

document.getElementById('submit_btn').addEventListener('click', goto);

You may want to avoid using goto as your function's name too. It may be a reserved keyword.

Some Guy
  • 15,854
  • 10
  • 58
  • 67