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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:26:38+00:00 2026-05-29T19:26:38+00:00

I am using jQuery 1.4.3. I have some divs that have microdata in them

  • 0

I am using jQuery 1.4.3.

I have some divs that have microdata in them and I am trying to access them via jQuery in a loop. These divs will output much like rows and columns.

<div data-row="1" data-col="1">
<div data-row="1" data-col="2">
<div data-row="1" data-col="3">

<div data-row="2" data-col="1">
<div data-row="2" data-col="2">
<div data-row="2" data-col="3">

<div data-row="3" data-col="1">
<div data-row="3" data-col="2">
<div data-row="3" data-col="3">

I am trying to loop through each row and get the maximum height of each div in that row (although I am not doing exactly that with this code). With this code, I just want to be able to loop through how ever many rows there are.

This works and will produce three alerts of “1”:

// ACCESS THE HEIGHT OF EACH CELL
$("[data-row='1']").each(function() {
    var R = $(this).attr("data-row");
    alert(R);
});

What I expect to see when this runs is three alerts of “1”, followed by three alerts of “2”, followed by three alerts of “3”. I do not get any errors when the code “runs”. No alerts are thrown. This does NOT work:

$("[data-row>='1']").each(function() {
    var R = $(this).attr("data-row");
    alert(R);
});

What’s wrong with this piece of code? Why is it not finding any rows that have data-row value of 1 or greater?

  • 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-29T19:26:39+00:00Added an answer on May 29, 2026 at 7:26 pm

    HTML attributes are read as strings, not as ints. Also, according to the jQuery docs, attribute values should be quoted in selectors (as they are strings).

    That is why $("[data-row=1]") doesn’t work, and $("[data-row='1']") does.

    $("[data-row>='1']") doesn’t work because >= is not an attribute selector.

    To get divs with data-row >= 1, you’re gonna have to use filter, and check the value of data-row (p.s. you can do $("[data-row]") to get all divs with that attribute regardless of value).

    $("[data-row]").filter(function(){
        return parseInt($(this).data('row'), 10) >= 1;
    })
    

    NOTE: jQuery can use .data to get data-* attributes, instead of .attr.

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

Sidebar

Related Questions

I have some DIVs that I am using JQuery to hide and show using
I have some javascript that I'm trying to retool using jQuery to learn the
I have a form and some divs that I modify using jquery. On form
I have some content that I am loading using jquery ajax. The content has
i have some dynamic code that will make a list of divs. i want
So here is the issue, I have 6 divs that are using jQuery UI
Hey right now I'm using jQuery and I have some global variables to hold
I have some tabs using jQuery UI which work just fine, but I want
How to load/render a usercontrol using jquery? I have some menus on header of
I have some elements and I'm using some jQuery plugins. I want to see

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.