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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:18:26+00:00 2026-06-14T13:18:26+00:00

I want to compare 2 values under some conditions. If $(.value1).text() and $(.value2).text() start

  • 0

I want to compare 2 values under some conditions.

If $(".value1").text() and $(".value2").text() start with "v", then check whether
number of $(".value1").length (in this case 0.1)) < $(".value1").length (in this case 0.4)

<div class="value1">v0.1</div>
<div class="value2">v0.4</div>

First, I want to check whether the value of the div starts with "v", then I want to compare the value after the "v".

How would I do that and how would the syntax look like?

Your help is much appreciated.

  • 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-14T13:18:27+00:00Added an answer on June 14, 2026 at 1:18 pm
      var value1 = $('.value1').text();
      var value2 = $('.value2').text();
    
      if (value1.indexOf('v') == 0 && value2.indexOf('v') == 0) {
        var version1 = parseFloat(value1.substring(1), 10);
        var version2 = parseFloat(value2.substring(1), 10);
        if (version1 > version2) {
          document.write(value1 + ' > ' + value2);
        }
        else if (version1 < version2) {
          document.write(value1 + ' < ' + value2);
        }
        else {
          document.write(value1 + ' == ' + value2);
        }
      }
    

    A working example: http://jsfiddle.net/Kncf4/

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

Sidebar

Related Questions

i want to compare two number values in a shell script (sh) but it
I want to compare some floating values . To do,my query is like :
Hi i want to compare all the values of 2 arrays and end up
I have 3 values that I want to compare f, g and h. I
I have multiple arrays with string values and I want to compare them and
how can i compare values in a loop? i just want to compare all
I want to compare two double values till the second digit from decimal point.
I want to use if in xsl to compare two values, but i want
I have a two lists with values that I want to compare. If the
I have two dictionaries which i want to compare the values. Like Dict1['var1'] =

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.