0

index.html

type <!DOCTYPE html>
<html>
<head>`your text`
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>Page Title</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    
    <script src='main.js'></script>
</head>
<body>
    <img src="twitter.jpg" id="tv">
    <button id="btn" >OK</button>
    
</body>
</html>here

main.js $("#btn").on("click",function (){ $('#tv').hide(); }) When I click on button nothing happens

when I write a special function in main.js and call it from index.html, it works

Jose Manuel de Frutos
  • 1,040
  • 1
  • 7
  • 19

0 Answers0