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

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현