I want to redirect the user automatically into another page if this text exist 'Shopping Cart is Empty'. I found this jQuery :contains() Selector and test on it but It didn't work. Here's my code:
<div class="page-title">
<h1>Shopping Cart is Empty</h1>
</div>
<script>
$( "div.page-title:contains('Shopping Cart is Empty')".window.location.replace("http://www.another-page.com");
</script>
$(function () {
var len = $("div.page-title h1").filter(function () {
return this.innerHTML === "Shopping Cart is Empty";
}).length;
if (len > 0) {
window.location.replace("http://www.another-page.com");
}
});
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments