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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:57:27+00:00 2026-05-25T02:57:27+00:00

On my web page, I output jQuery for each record that is rendered on

  • 0

On my web page, I output jQuery for each record that is rendered on the page like this:

if ($.trim($('#attachment<%# Eval("Id")%> .content').html()) == '') {
  $('#attachmentClick<%# Eval("Id")%>').hide();
}

Notice there is server binding on the element ID to make sure each record has the jQuery processed. Is there a way to do this only once on the page by embedding the conditional statement, such as “for all $(this.ID + ' .attachmentsClick'), hide only if $('.attachments.content').html() trimmed is blank”?

  • 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-05-25T02:57:27+00:00Added an answer on May 25, 2026 at 2:57 am

    You could use jQuery’s filter function to reduce the set of potential elements to those with empty content, and then hide them:

    $('.attachmentsClick').filter(function(){
        return $.trim($(this).find('.content').html()) == '';
    }).hide();
    

    This assumes that you give the class of “attachmentsClick” to all of your row elements. It does not need the ID of the row elements. Just run this after your content has loaded, and it will hide all elements with a class of “attachmentsClick” that have a child with a class of “content” which is empty when trimmed.

    Your HTML might look something like:

    <div class="attachmentsClick"><!-- this one will be hidden -->
      <div class="content"></div>
    </div>
    
    <div class="attachmentsClick"><!-- this one will be hidden too -->
      <div class="content">     </div>
    </div>
    
    <div class="attachmentsClick"><!-- this one will NOT be hidden -->
      <div class="content"><p>some content<p></div>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My web page sits in a DIV that is 960px wide, I center this
This web page http://www.w3schools.com/ASP/prop_sessionid.asp states that a session ID is generated on the ServerSide.
web page : http://sideradesign.com/eco-art/gallery/ This code works fine in all brwosers except IE8 (haven't
I'm downloading a web page (tag soup HTML) with XMLHttpRequest and I want to
I have a web page on which I would like to display dynamically a
I'm trying to use jQuery and JSON with a C# Web Service that I
I'm making a web page that includes a clock with an arrow in the
Scenario: I have a Javascript-generated web page that someone else wrote a long time
I am trying to display an .svg file in a HTML page using jQuery
I was using pyquery to construct a webpage: > page = PyQuery('<html><head><script type=text/javascript src=jquery-1.4.min.js></script><script

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.