Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8019485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:23:59+00:00 2026-06-04T21:23:59+00:00

As the jQuery API is currently down, is anyone able to assist me with

  • 0

As the jQuery API is currently down, is anyone able to assist me with the below? I am ajax loading an unordered list into the web page and need to be able to attach hover and click events to the list items.

<ul>
  <li class="option">Item 1</li>
  <li class="option">Item 1</li>
  <li class="option">Item 1</li>
</ul>

So far I have tried a few variations of the below jQuery code using .on for version 1.7+

$("ul").on("click", "li .option", function(){
alert($(this).text());
}); 

Can anyone point me in the right direction? I’m aware that .live has been deprecated and that .delegate has been superseded so really only looking for a solution that will allow me to use .on.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:24:01+00:00Added an answer on June 4, 2026 at 9:24 pm

    Not li .option, because it find element within li with class option, but you have this class to li, so it will be li.option or .option.

    So for .on(), it looks like:

    $("ul").on("click", "li.option", function(){
       alert($(this).text());
    });
    

    But for .delegate(), it looks like:

    $("ul").delegate("li.option", "click", function(){
       alert($(this).text());
    });
    

    According to you edit

    you’re trying to bind click to li.option with container reference ul, which is also append to DOM alter. So you can go for #content, which already exists in DOM ans where you append you whole list.

    So delegate event will looks like:

    $("#content").delegate("ul > li.option", "click", function(){
       alert($(this).text());
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey All, I currently use Google's API to include jQuery into my sites like
in this page http://api.jquery.com/category/effects/ when you put 'up'(keyboard) and 'down',then put 'enter',it will go
I'm currently working with Google Maps API v3, with jQuery, and MarkerClusterer. I note
Possible Duplicate: jQuery 1.7 - Turning live() into on() According to the jQuery API
I am using the jquery ajax api so load in some content, the code
so i'm currently trying to implement a currency conversion script using Jquery, curl, ajax
In my PhoneGap/jQuery Mobile app, I'm currently using PhoneGaps' Camera API to allow the
I'm currently looking into chaining my jquery code. An element needs to ditch a
I have a function that makes a jQuery Ajax call to the BART api
I'm using the jQuery load() event to load a page into an iframe. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.