开发者

Events and other stuff does not work in general

I got my static HTML(5) file with jQuery (latest release), and nothing that I tried got my jQuery Code running.

origin html

<!DOCTYPE html>
<html>
<head>
<title>BynGame</title>
<script type="text/javascript" src="/js/libs/jQuery.js"></script>
<script>
$(document).ready(jInit);
function jInit(){
    $.('#thebutton').click( function() { alert("HIT THE WALL");} );
}
</script>
</head>

<body>
<div><span>{{ login }}</span></div>
<div class="navbar">
<a href="/"><span>Home</span></a>
<a href="/submit"><span>Neuen Eintrag erstellen</span></a>
<a href="/all"><span>Channel&#252;bersicht</span></a>
<a href="/register"><span>Registrieren</span></a>
</div>
<div>
<span id="thefield"></span>
<br />
<div id="hitme">Click Me or Hit Me</div>
<div id="blu" style="background:blue;">
<button id="thebutton" type="submit">
Push The Button!    
</button>
</div>
</div>
</body>
</html>

I checked W3C.org and it occured NO validation error开发者_如何学Go. (Even no related warnings)

Now changing between $.(document).ready(jInit) and $.(document).ready(jInit()) makes no difference.

  • Putting .ready() before or after jInit() does not affect the code.
  • Putting something different into jInit() does not affect the code.
  • Renaming jInit() to something else....
  • Using different jQuery refs......
  • simply calling $.get("#thebutton').click( function() { that I wrote; }); doesn't work

The only thing that works is: (without any other code in front of it, otherwise it seems to be broken)

$(document).ready(function() {alert("bla");});

Am I missing some basic Javascript Syntax? I am completely frustrated... because implementing JS into my Project is really essentiall and I turned to try to get the simpliest stuff to work, but event this fails.


$('#thebutton') instead of $.('#thebutton')

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜