Hide First Word of Span by using Css or Jquery

后端 未结 2 742
渐次进展
渐次进展 2021-01-27 11:38

I want to hide first word(ILS) from the span by using css..I have a div which have no class and inside that div there is a span...I just want to hide this word(ILS) from the spa

相关标签:
2条回答
  • 2021-01-27 11:52

    Preferably you add an id to the span or already send the right thing in the backend but: You can just replace the content.

    <head><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
    <script>$(document).ready(
    function(){
    $('span').text($('span').text().replace('ILS',''));
    });
    </script>
    </head>
    
    
        <div class="purhstdtls-delvry-timesec">
          <h5>Test Sample</h5>
          <div class="purchase-price"></div>
          <div>Some Text Here</div>
          <div>
                <span>ILS 0.10 / מכירה</span>
          </div>
        </div>

    It's a dirty solution but it'll work.

    0 讨论(0)
  • 2021-01-27 12:08

    You can add wrapper around your required text to be hidden in your case ILS, Try following Code

    $(document).ready(function(){
        $("span:contains(ILS)").each(function(k,v){
            var d = $(v).html();
            d = d.replace("ILS", "<div style='display:none'>ILS</div>");
            $(v).html(d);
        });
    });
    
    0 讨论(0)
提交回复
热议问题