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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:32:39+00:00 2026-06-09T16:32:39+00:00

For a jquery plugin to work I have to set the img with the

  • 0

For a jquery plugin to work I have to set the img with the class lazy to display: none from CSS.

I know how to make it appear when I need it using jquery:

$("img.lazy").show();

The problem is that I am loading the jquery library in the footer and I need the image to appear when the page starts to load.

I cannot move the code to the header cause there is no jquery.

So I am thinking of doing it with javascript.

I have tried getElementbyID but I can’t make it work.

Any ideas?

  • 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-09T16:32:40+00:00Added an answer on June 9, 2026 at 4:32 pm

    You can use following to display all images with class name lazy using querySelectorAll

    var el = document.querySelectorAll("img.lazy");
    for(i=0;i<el.length;i++) el[i].style.display='block';
    

    DEMO.

    For single element you can use querySelector

    var el = document.querySelector("img.lazy"); // only one/the first img with class name lazy
    el.style.display='block';
    

    DEMO.

    Browser compatibility for querySelector/querySelectorAll.

    Alternative (runs in every browser)

    ​var els=document.getElementsByTagName('img');
    if(els)
    {
        for(i=0;i<els.length;i++)
        {
            if(els[i].className.match(/lazy/)) els[i].style.display='block';
        }
    }
    

    DEMO.

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

Sidebar

Related Questions

I have the jQuery numberformatter-plugin installed, but don´t get it to work correctly. I
I found this great Tablesorter plugin for jQuery but I can't make it work
I'm looking for a jQuery plugin / library that makes the contentEditable attribute work
this code in my plugin used to work just fine: jQuery('#embedded_obj', context).get(0).getVersion(); and the
I have a jQuery plugin, supersized 3.2.7 working in Chrome and Firefox but just
I still have troubles using jquery fileupload plugin, only on IE. The javascript is
I am working on a small jQuery plugin that autoscrolls through a set of
Hoping someone can give me a hand here.... I have the DataTables jquery plugin
I'm using Jquery Mobile pagination plugin and trying to work it into a plugin
I'm trying to integrate CSS pagination into a thumbnail gallery I have set up

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.