temporary_user_name
temporary_user_name

Reputation: 37018

Problems with jQuery in a PhoneGap app

Can't seem to get it included. I was using this:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

and then had this:

<script type="text/javascript">

function initialize(){

 $(document).ready(function() {
   $("a").click(function() {
     alert("Hello world!");
   });
 });

}

</script>

....

<body onload="initialize()">
<a href="">Link</a>
</body>

But when I click the link, nothing happens. I have no way of knowing whether jQuery is even including properly. I'm completely new to jQuery, so for all I know I'm making an obvious error here, but it's straight from the jQuery beginner guide, so I'd think it was close at least. Anyone?

Upvotes: 1

Views: 527

Answers (1)

Derek 朕會功夫
Derek 朕會功夫

Reputation: 94309

You can just remove that function. It is useless.

$(function(){
    $("a").click(function(){
        alert("Hello world!");
    });
});

PS: Your code in work: http://jsfiddle.net/DerekL/h4dmF/

Upvotes: 2

Related Questions