Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

jQuery Events - 16

Download

Right click “Save as…”

This lesson shows how to utilize jQuery Events to create a simple game by writing and attaching anonymous functions to events fired on a web page.

Tag:

Follow the Discussion

  • There's some subtlety as to why the score variable can retain its value between clicks. I understand it because of my experience with C#, lambda expressions, and closures, but it might not be so obvious to the beginning programmer.

  • AliAli

    Hi Bob , I really appreciate this series . it is so helpful and enlightening .

    I have two questions :
    if I have a loop ($.each) and inside I have a nested "if" statement when I am using the "return" keyword in the if statement it returns to the containing "each" statement instead of exit the function. what am I doing wrong ? ie:
    $('#btn').click(function () {
    var found = false;
    $.each(star1, function (i, val) {
    if (val == $('#starName').val()) {
    found = true;
    return ('found!!!'); // although that it is found the loop keep on going
    } else {
    if (i == (star1.length - 1)) {
    if (!found) {
    return ('not found');
    }//not found
    };
    };//end else
    });//end each

    });//end click

  • plok18644plok18644

    thank you bob tabor

  • guih6777guih6777

    I have never seen www.LearnVisualStudio.net

  • JacobJacob

    Hi Bob, is there a JQuery shortcut for every single Javascript command?

  • JacobJacob

    Also, I'm a little confused regarding the src script with the following anchor tag: http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.7.1.js

    Are we supposed to download jQuery, or can we just link all of our html files to that address?

    Thanks in advance.

  • @Ali: When you put () around the value you're returning, you confuse javascript ... you're saying you want to call a method called return instead of the keyword.  Remove the () around ('found!!!') and I'm betting it will work.  Good luck!

    @Bob tabor is a idoit: . . . classy.  And grammatically challenged.

    @plok18644: You're welcome!

    @guih6777: How did you miss it!?  Wink

    @lib115634: Sorry?

    @Jacob: re: shortcuts ... I don't think so.  Just for the ones that are laborious to write.

    @Jacob: re: download ... You only reference THAT SINGLE FILE, the actual jQuery library file -->  jquery-1.7.1.js ... it is located at a number of web sites where it can be quickly downloaded (or perhaps even cached, if other web site builders like yourself use the same exact URL to host the file).  The remainder of your HTML , CSS and image files will point to YOUR domain name.  Hope that helps!

     

  • rohitrohit

    hi bob,
    I feel like a devloper.

    Thanks.

  • TinTinTinTin

    So if I want to reset the score when I click Start Over, how would the code look like(what do U have to modify)?

  • @TinTin: Hi TinTin ... I'm am absolutely NOT trying to be a smart aleck in what I'm about to say ... I believe in the "teach a man to fish and he'll fish for himself the rest of his life" philosophy.  So, tell me what you've tried already and let me walk you through it if you get stuck.  Hopefully if you've been following along up to this point, you should be able to do exactly what you're asking. 

    If you don't struggle, you don't truly learn.

  • TinTinTinTin

    Hello Bob,

    Thank you for the reply, I figured it out, had a bug in my code. The text would reset when I clicked start over, but it would display the score being 0 only after I hovered it one more time :))

    It is fixed now.

    Thanks for the series!

  • TinTinTinTin

    Hello Bob,

    Thank you for the reply, I figured it out, had a bug in my code. The text would reset when I clicked start over, but it would display the score being 0 only after I hovered it one more time :))

    It is fixed now.

    Thanks for the series!

  • GowriGowri

    need videos related to proxy in javascript

  • MohamedMohamed

    Thank you Bob Tabor

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.