Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Fucntion call problem

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #171560
    matthisco
    Participant

    Hello,

    Can anyone please tell me how I can combine both events below to call a function? I would like something to happen is the id field loses focus or a button is clicked:

        $("#id").live("change", function() && $( "#button" ).click(function(){
    do something
    }
    
    #171598
    __
    Participant

    @matthisco, just FYI, live is deprecated. You might be interested in looking at on, which succeeds live and would also allow you to assign both handlers at once:

    $(".element").on({
        "change": yourChangeFunction(),
        "click":  yourClickFunction()
    });
    
    #171745
    matthisco
    Participant

    Thanks very much

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.