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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:26:26+00:00 2026-06-11T19:26:26+00:00

Can anybody help me modify this jQuery code shorter? HTML code: <div id=blinker1><img src=aaa.png

  • 0

Can anybody help me modify this jQuery code shorter?

HTML code:

 <div id="blinker1"><img src="aaa.png" /></div>
 <div id="blinker2"><img src="bbb.png" /></div>
 <div id="blinker3"><img src="ccc.png" /></div>
 <div id="blinker4"><img src="ddd.png" /></div>
 <div id="blinker5"><img src="eee.png" /></div>

jQuery code:

function smBlink(){
    //blink 3times
    for(i=0;i<3;i++) {
        $("#blinker1, #blinker2, #blinker3, #blinker4, #blinker5").fadeTo('normal', 0.3).fadeTo('normal', 1.0);
    }
};

These taget IDs have same prefix(#blinker) and followed by sequential numbers.
I think array function would help…but I dont know how.
These divs would be increased or decreased in future.

  • 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-11T19:26:28+00:00Added an answer on June 11, 2026 at 7:26 pm

    You could use an “attribute starts-with” selector:

    $("div[id^='blinker']").fadeTo('normal', 0.3).fadeTo('normal', 1.0);
    

    This will allow you to add/remove elements with matching IDs as necessary.

    If you are able to modify your markup, it would be more efficient to replace the id attributes with a shared class name. You can then use a normal class selector:

    $(".blinker").fadeTo('normal', 0.3).fadeTo('normal', 1.0);
    

    This approach would mean the selector engine can take advantage of the speed of the native getElementsByClassName function where available.

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

Sidebar

Related Questions

Can anybody help me with this simple code?? #include <iostream> using namespace std; void
I'm having trouble with this code can anybody help... var imageMap:ImageSnapshot= ImageSnapshot.captureImage(object); var pixelValue:uint
Can anybody help me to fix this code, I really need it, but have
Can anybody help, I`m starter in web? Here is code: <head> <meta http-equiv=Content-Type content=text/html;
can anybody help me understand how Honda achieved this effect: http://testdays.hondamoto.ch/ I mean the
can anybody help me solve this : i got $filename= index 198.php; i use
can anybody help with this , I can get the 3 states to work
Can anybody help me understand why this update query isn't updating the fields in
Can anybody help me out with this exception. I have tried couple of fixes
can anybody help me with this ? I have added some custom fields to

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.