jQuery Hide div if price value is smaller than #2How can I get jQuery to perform a synchronous, rather than asynchronous, Ajax request?Using jQuery to center a DIV on the screenChange the selected value of a drop-down list with jQueryCreating a div element in jQueryHow to replace innerHTML of a div using jQuery?Use jQuery to hide a DIV when the user clicks outside of itHow to apply !important using .css()?jQuery Hide div if value is smaller thanHow to hide div using jquery or java script if value is 0.00?How to hide div using jquery or java script?

What is a solution?

Why doesn't sea level show seasonality?

RPI3B+: What are the four components below the HDMI connector called?

How to tell someone I'd like to become friends without letting them think I'm romantically interested in them?

Was I subtly told to resign?

Keep milk (or milk alternative) for a day without a fridge

How can I calculate the sum of 2 random dice out of a 3d6 pool in AnyDice?

Is a request to book a business flight ticket for a graduate student an unreasonable one?

During copyediting, journal disagrees about spelling of paper's main topic

Is "I do not want you to go nowhere" a case of "DOUBLE-NEGATIVES" as claimed by Grammarly?

How to convert a file with several spaces into a tab-delimited file?

How can I get a player to accept that they should stop trying to pull stunts without thinking them through first?

What's the point of having a RAID 1 configuration over incremental backups to a secondary drive?

How can a dictatorship government be beneficial to a dictator in a post-scarcity society?

Is there any word for "disobedience to God"?

Why does this quadratic expression have three zeroes?

Managing and organizing the massively increased number of classes after switching to SOLID?

How is angular momentum conserved for the orbiting body if the centripetal force disappears?

Are randomly-generated passwords starting with "a" less secure?

Cracking the Coding Interview — 1.5 One Away

Can fluent English speakers distinguish “steel”, “still” and “steal”?

Why does the U.S. tolerate foreign influence from Saudi Arabia and Israel on its domestic policies while not tolerating that from China or Russia?

Has anyone in space seen or photographed a simple laser pointer from Earth?

Single word for "refusing to move to next activity unless present one is completed."



jQuery Hide div if price value is smaller than #2


How can I get jQuery to perform a synchronous, rather than asynchronous, Ajax request?Using jQuery to center a DIV on the screenChange the selected value of a drop-down list with jQueryCreating a div element in jQueryHow to replace innerHTML of a div using jQuery?Use jQuery to hide a DIV when the user clicks outside of itHow to apply !important using .css()?jQuery Hide div if value is smaller thanHow to hide div using jquery or java script if value is 0.00?How to hide div using jquery or java script?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








-1















I have this div with small price and another div (discounted) with higher price



<span class="ty-price" id="line_discounted_price_28797">
<bdi><span class="ty-price-num">£</span><span id="sec_discounted_price_28797" class="ty-price-num">0.99</span></bdi></span>


so when dicount div get higer price than above div then it should need to hide



<div class="ut-qty-discount">
<div class="ut-qty-discount-price"><bdi>£<span>1.79</span></bdi></div>
</div>


If #1 price value smaller than #2
then i need to hide #2










share|improve this question






























    -1















    I have this div with small price and another div (discounted) with higher price



    <span class="ty-price" id="line_discounted_price_28797">
    <bdi><span class="ty-price-num">£</span><span id="sec_discounted_price_28797" class="ty-price-num">0.99</span></bdi></span>


    so when dicount div get higer price than above div then it should need to hide



    <div class="ut-qty-discount">
    <div class="ut-qty-discount-price"><bdi>£<span>1.79</span></bdi></div>
    </div>


    If #1 price value smaller than #2
    then i need to hide #2










    share|improve this question


























      -1












      -1








      -1


      1






      I have this div with small price and another div (discounted) with higher price



      <span class="ty-price" id="line_discounted_price_28797">
      <bdi><span class="ty-price-num">£</span><span id="sec_discounted_price_28797" class="ty-price-num">0.99</span></bdi></span>


      so when dicount div get higer price than above div then it should need to hide



      <div class="ut-qty-discount">
      <div class="ut-qty-discount-price"><bdi>£<span>1.79</span></bdi></div>
      </div>


      If #1 price value smaller than #2
      then i need to hide #2










      share|improve this question
















      I have this div with small price and another div (discounted) with higher price



      <span class="ty-price" id="line_discounted_price_28797">
      <bdi><span class="ty-price-num">£</span><span id="sec_discounted_price_28797" class="ty-price-num">0.99</span></bdi></span>


      so when dicount div get higer price than above div then it should need to hide



      <div class="ut-qty-discount">
      <div class="ut-qty-discount-price"><bdi>£<span>1.79</span></bdi></div>
      </div>


      If #1 price value smaller than #2
      then i need to hide #2







      jquery






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 26 at 2:28









      Aniket G

      2,7591 gold badge6 silver badges31 bronze badges




      2,7591 gold badge6 silver badges31 bronze badges










      asked Mar 26 at 2:26









      kriskris

      228 bronze badges




      228 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Use parseFloat() to use math operations on the characters.



          To get the first number, use the ^= (starts-with) selector on the id. The below means find the element with an ID that begins with... - and get the text inside that element:



          let prx = $('[id^=sec_discounted_price]').text();


          For the second number, you need to locate the first span via class, then traverse down to the second span:



          let dsc = $('.ut-qty-discount-price>bdi>span').text();


          Here is the working demo:






          $('button').click(function()
          let prx = $('[id^=sec_discounted_price]').text();
          let dsc = $('.ut-qty-discount-price>bdi>span').text();
          if (parseFloat(prx) < parseFloat(dsc) )
          $('.ut-qty-discount-price').hide();

          );

          <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
          <span class="ty-price" id="line_discounted_price_28797">
          <bdi><span class="ty-price-num">£</span><span id="sec_discounted_price_28797" class="ty-price-num">0.99</span></bdi></span>

          <div class="ut-qty-discount">
          <div class="ut-qty-discount-price"><bdi>£<span>1.79</span></bdi></div>
          </div>

          <button>Calculate</button>








          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348995%2fjquery-hide-div-if-price-value-is-smaller-than-2%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            Use parseFloat() to use math operations on the characters.



            To get the first number, use the ^= (starts-with) selector on the id. The below means find the element with an ID that begins with... - and get the text inside that element:



            let prx = $('[id^=sec_discounted_price]').text();


            For the second number, you need to locate the first span via class, then traverse down to the second span:



            let dsc = $('.ut-qty-discount-price>bdi>span').text();


            Here is the working demo:






            $('button').click(function()
            let prx = $('[id^=sec_discounted_price]').text();
            let dsc = $('.ut-qty-discount-price>bdi>span').text();
            if (parseFloat(prx) < parseFloat(dsc) )
            $('.ut-qty-discount-price').hide();

            );

            <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
            <span class="ty-price" id="line_discounted_price_28797">
            <bdi><span class="ty-price-num">£</span><span id="sec_discounted_price_28797" class="ty-price-num">0.99</span></bdi></span>

            <div class="ut-qty-discount">
            <div class="ut-qty-discount-price"><bdi>£<span>1.79</span></bdi></div>
            </div>

            <button>Calculate</button>








            share|improve this answer



























              1














              Use parseFloat() to use math operations on the characters.



              To get the first number, use the ^= (starts-with) selector on the id. The below means find the element with an ID that begins with... - and get the text inside that element:



              let prx = $('[id^=sec_discounted_price]').text();


              For the second number, you need to locate the first span via class, then traverse down to the second span:



              let dsc = $('.ut-qty-discount-price>bdi>span').text();


              Here is the working demo:






              $('button').click(function()
              let prx = $('[id^=sec_discounted_price]').text();
              let dsc = $('.ut-qty-discount-price>bdi>span').text();
              if (parseFloat(prx) < parseFloat(dsc) )
              $('.ut-qty-discount-price').hide();

              );

              <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
              <span class="ty-price" id="line_discounted_price_28797">
              <bdi><span class="ty-price-num">£</span><span id="sec_discounted_price_28797" class="ty-price-num">0.99</span></bdi></span>

              <div class="ut-qty-discount">
              <div class="ut-qty-discount-price"><bdi>£<span>1.79</span></bdi></div>
              </div>

              <button>Calculate</button>








              share|improve this answer

























                1












                1








                1







                Use parseFloat() to use math operations on the characters.



                To get the first number, use the ^= (starts-with) selector on the id. The below means find the element with an ID that begins with... - and get the text inside that element:



                let prx = $('[id^=sec_discounted_price]').text();


                For the second number, you need to locate the first span via class, then traverse down to the second span:



                let dsc = $('.ut-qty-discount-price>bdi>span').text();


                Here is the working demo:






                $('button').click(function()
                let prx = $('[id^=sec_discounted_price]').text();
                let dsc = $('.ut-qty-discount-price>bdi>span').text();
                if (parseFloat(prx) < parseFloat(dsc) )
                $('.ut-qty-discount-price').hide();

                );

                <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
                <span class="ty-price" id="line_discounted_price_28797">
                <bdi><span class="ty-price-num">£</span><span id="sec_discounted_price_28797" class="ty-price-num">0.99</span></bdi></span>

                <div class="ut-qty-discount">
                <div class="ut-qty-discount-price"><bdi>£<span>1.79</span></bdi></div>
                </div>

                <button>Calculate</button>








                share|improve this answer













                Use parseFloat() to use math operations on the characters.



                To get the first number, use the ^= (starts-with) selector on the id. The below means find the element with an ID that begins with... - and get the text inside that element:



                let prx = $('[id^=sec_discounted_price]').text();


                For the second number, you need to locate the first span via class, then traverse down to the second span:



                let dsc = $('.ut-qty-discount-price>bdi>span').text();


                Here is the working demo:






                $('button').click(function()
                let prx = $('[id^=sec_discounted_price]').text();
                let dsc = $('.ut-qty-discount-price>bdi>span').text();
                if (parseFloat(prx) < parseFloat(dsc) )
                $('.ut-qty-discount-price').hide();

                );

                <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
                <span class="ty-price" id="line_discounted_price_28797">
                <bdi><span class="ty-price-num">£</span><span id="sec_discounted_price_28797" class="ty-price-num">0.99</span></bdi></span>

                <div class="ut-qty-discount">
                <div class="ut-qty-discount-price"><bdi>£<span>1.79</span></bdi></div>
                </div>

                <button>Calculate</button>








                $('button').click(function()
                let prx = $('[id^=sec_discounted_price]').text();
                let dsc = $('.ut-qty-discount-price>bdi>span').text();
                if (parseFloat(prx) < parseFloat(dsc) )
                $('.ut-qty-discount-price').hide();

                );

                <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
                <span class="ty-price" id="line_discounted_price_28797">
                <bdi><span class="ty-price-num">£</span><span id="sec_discounted_price_28797" class="ty-price-num">0.99</span></bdi></span>

                <div class="ut-qty-discount">
                <div class="ut-qty-discount-price"><bdi>£<span>1.79</span></bdi></div>
                </div>

                <button>Calculate</button>





                $('button').click(function()
                let prx = $('[id^=sec_discounted_price]').text();
                let dsc = $('.ut-qty-discount-price>bdi>span').text();
                if (parseFloat(prx) < parseFloat(dsc) )
                $('.ut-qty-discount-price').hide();

                );

                <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
                <span class="ty-price" id="line_discounted_price_28797">
                <bdi><span class="ty-price-num">£</span><span id="sec_discounted_price_28797" class="ty-price-num">0.99</span></bdi></span>

                <div class="ut-qty-discount">
                <div class="ut-qty-discount-price"><bdi>£<span>1.79</span></bdi></div>
                </div>

                <button>Calculate</button>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 26 at 2:39









                cssyphuscssyphus

                24.2k10 gold badges64 silver badges83 bronze badges




                24.2k10 gold badges64 silver badges83 bronze badges


















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348995%2fjquery-hide-div-if-price-value-is-smaller-than-2%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript