HTML is not calling function - JS

0

Good afternoon,

I've been trying to figure out the reason for the code: link does not work outside of JSFIDDLE. Even though I'm copying the way it is, and creating my .HTML and .JS files, it just does not execute the function.

The jQuery library is being included, as well as including my .JS in HTML

<script src="http://code.jquery.com/jquery-1.9.1.js"></script><scripttype="text/javascript" language="JavaScript" src="test.js"></script>

Finally, I tried debugging but no error appears in either IE 11 or Chrome.

Does anyone have an idea what it could be?

    
asked by anonymous 07.04.2017 / 21:56

3 answers

0

puts it inside $(document).ready(); , because only at the end of loading everything, it will try to execute the code and will succeed.

$(document).ready(function(){

  $('#data').change(function() {
    $('.hideShowTr').css('display', 'none');
    $('tr#' + $(this).val()).css('display', 'table-row');
  });

});
    
07.04.2017 / 21:59
0

answering a question when you put $ (document) .ready (funciton () { // code })

he expects the page to load completely so that a jquery function can be done and in this way causes all instances made by jquery to work

    
07.04.2017 / 22:06
0

try to execute the js code in the script tag, just to test.

Once this happened and it was logic error. And it would break when I was going to call js.

If it does not work, try renaming it with another name, type code.js, just to test it.

    
08.04.2017 / 01:26