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 9258667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:27:56+00:00 2026-06-18T12:27:56+00:00

selector can get image contain the attribute onclick within the onclick there is a

  • 0

selector can get image contain the attribute onclick

within the onclick there is a JS code ( windows.open ….href start with (/dailyTickets/front/requesttype.form.php) )

i want some thing like this :

 var attr = $('img').attr('onclick');
    if(typeof attr !== 'undefined' && attr !== false)
    {
$ImgIndex = $('img').attr('onclick').value().indexOf("var w = window.open('/dailyTickets/front/requesttype.form.php").index();

       if ($('img').attr('onclick').value().indexOf("var w = window.open('/dailyTickets/front/requesttype.form.php") == 0)
    {
       $('img:eq('"+$ImgIndex +"').hide();
    }
    }

you can test it here : http://jsfiddle.net/zu44E/3/

here is the image :

<img 
    alt="" 
    title="Ajouter" 
    src="/dailyTickets/pics/add_dropdown.png" 
    style="cursor:pointer; margin-left:2px;" 
    onclick="var w = window.open('/dailyTickets/front/requesttype.form.php?popup=1&amp;rand=1489777051', 'glpipopup', 'height=400, width=1000, top=100, left=100, scrollbars=yes' );w.focus();"
></img>
  • 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-18T12:27:58+00:00Added an answer on June 18, 2026 at 12:27 pm

    I think your method is slightly off. First of all. Here’s my update:

    http://jsfiddle.net/zu44E/7/

    Here are the major changes I made:

    1. After selecting an attr you don’t get the value of that attr by calling value()
    2. If you assign a variable to a series of chained function calls, what you end up with is the last value in the chain not the first so the value of your $ImgContains variable, had your method worked, would have been a true/false because you equate the indexOf to 0 (thus boolean, true or false)
    3. Take advantage of jquery. Jquery can do bulk operations on records. You don’t need to go element-by-element looking for things. In the case you need to do a test that’s more in depth and it is more or less element by element, use iterative jquery methods such as filter
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I get the adjacent sibling of a dynamic selector? This is what
can anyone offer a selector to do away with this horrible chunk of code:
Is there a Python library that can parse an CSS selector and emit an
Is there any way that I can pass arguments in selector? example: I have
I have a header within the following html page and I can't get the
I'm trying to find a CSS selector that can help me distinguish between the
How can I check selector to see if he is ending with number? JS
How can I make this link use the child selector without changing or removing
I can send requests to friends using Multi Friend Request Selector inside my Page
How can I remove certain font size options from the font size selector in

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.