I want to insert the break tag before the Estimated Time of Arrival Can Anybody Help
<span class="avl">Excludes: Northern Territory, QLD Far North, QLD Regional, WA Regional, WA Remote Estimated Time of Arrival: 3-8 Business Days,</span>
You can get the text of that particular span and then add <br>
tag next to the occurring string as shown.
$(document).ready(function(){
var string = $(".avl").text();
var usingBreak = string.replace("Estimated Time of Arrival", "<br/>Estimated Time of Arrival");
$(".avl").html(usingBreak );
});
Use replace
function.
Here's the code for that (say you have the content of the span in a variable called str
):
var withBreak = str.replace("Estimated Time of Arrival", "<br/>Estimated Time of Arrival");
If you don't have the text stored in a variable, you could use Document.querySelector and then use .text()
to get the content of your span. Than after you changed the value you can just set the Text to your edited string.