0

Does anyone has an idea how to properly start or begin a function inside the script? Here is my code.

<script>
    $(document).ready(function(e){
        $('.search-panel .dropdown-menu').find('a').click(function(e) {
            e.preventDefault();
            var param = $(this).attr("href").replace("#","");
            var concept = $(this).text();
            $('.search-panel span#search_concept').text(concept);
            $('.input-group #search_param').val(param);
        });
    });
    var a = document.getElementByTagName('a').item(0);
    $(a).on('keyup', function(evt){
        console.log(evt);
        if(evt.keycode === 13){

            alert('search?');
        }
    });
</script>

Here is the error i am getting:

Uncaught ReferenceError: $ is not defined at (index):52
(anonymous) @ (index):52
v

justronux
  • 103
  • 2
  • 9

1 Answers1

1

Since your code contains JQuery snippets, you will need place JQuery library before calling it's respective functions.

Saharsh
  • 1,056
  • 10
  • 26
Rimon Arif
  • 36
  • 4