Rashmi S
Rashmi S

Reputation: 55

Jquery replacewith() function is not working in my page

I want to replace the text of button. I want to replace "Read more" text with "Läs mer". U can check the URL:http://www.hummingbird.se/blogg-test/

I am trying this code. HTML

<div class="vc_btn3-container vc_btn3-left">
<a href="http://www.hummingbird.se/kryssning-fran-hawaii/" class="vc_gitem-link vc_general vc_btn3 vc_btn3-size-md vc_btn3-shape-rounded vc_btn3-style-flat vc_btn3-color-juicy-pink" title="Read more">Read more</a>
</div>

<script type="text/javascript">
    jQuery(document).ready(function($){
      $(".vc_btn3-left > a").replaceWith("Läs mer");
});

Upvotes: 0

Views: 140

Answers (2)

Bharat
Bharat

Reputation: 2464

jQuery(document).ready(function($){
      $(".vc_btn3-left > a").text("Läs mer");
});
<div class="vc_btn3-container vc_btn3-left">
<a href="http://www.hummingbird.se/kryssning-fran-hawaii/" class="vc_gitem-link vc_general vc_btn3 vc_btn3-size-md vc_btn3-shape-rounded vc_btn3-style-flat vc_btn3-color-juicy-pink" title="Read more">Read more</a>
</div>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>

You can try like this, text() will replace with new text

$(".vc_btn3-left > a").text("Läs mer");

Upvotes: 1

Jasmit Tarang
Jasmit Tarang

Reputation: 135

$(".vc_btn3-left > a").html("Läs mer");

That should replace the html content of that class.

Upvotes: 1

Related Questions