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

  • Home
  • SEARCH
  • 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 8394565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:05:38+00:00 2026-06-09T20:05:38+00:00

I have done a simple selector for example: $(‘div’).eq(0).selector;// returns div.slice(0,1) $($(‘div’).eq(0).selector);// would not

  • 0

I have done a simple selector for example:

$('div').eq(0).selector;// returns     "div.slice(0,1)"
$($('div').eq(0).selector);// would not work... 

should the eq(0) not had been there it would work as it wont have the slice but a proper usable selector.

My problem is that, I wonder that using .selector, is not very helpful, and I have not tried other filters etc…

$('div').children().selector// returns "div.children()"

I am using jQuery 1.7.1, I really don’t see what the use of this .selector is for when it returns something that does not even work.

I was trying to make a plugin, but I thought of using the .selector to get elements added in the future (on the fly).

UPDATE

$.fn.myplugin(function (){
  $(this.selector)//select future elements...
})

Or is there another approach to this?

  • 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-09T20:05:39+00:00Added an answer on June 9, 2026 at 8:05 pm

    If you are making a plugin, what you would typically do is to provide an option with the selector to be used to refresh you list of elements. This option can also be exposed to the end-user so it can be customized.

    $('div').myPlugin({
        elements: 'ul > li'
    });
    

    If the need to detect future elements to bind events, use event delegation using .on().

    Long story short, you actually define an event handler on a container. The event will bubble up to the container and be executed if the element originally receiving the event matches the specified selector.

    <div id="container">
        <span>Some text</span>
        <button>Click me</button>
    </div>
    
    $('#container').on('click', 'button', function() { ... });
    

    This will bind one handler on the element #container and the event handler will be executed if an element <button> is clicked… but also for any <button> element added to the DOM afterwards.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hope I am not missing something very simple here. I have done a
I'm looking for a simple way to have this done. I would to have
I want to do a simple drag-drop using jQuery. I have not done anything
I have a simple web app, it's done with several JSP pages. I would
I have done a simple Hello World GWT example using JSNI. It does nothing
I have done simple java app for blackberry, while building am getting following error.
I have done a simple code for a slideshow that dynamicly loads images from
I have recently done a very simple highlighting with jQuery and a highlight plugin.
I've done some simple string -> DateTime conversions before using DateTime.ParseExact(), but I have
Say you have a simple loop while read line do printf ${line#*//}\n done <

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.