<script src="https://cdn.jsdelivr.net/sweetalert2/6.3.2/sweetalert2.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/sweetalert2/6.3.2/sweetalert2.min.css">
<script type="text/javascript" src="https://code.jquery.com/jquery-1.7.1.min.js"></script>
<a onclick="contactAdvertiser()" href="#">Contact Advertiser</a>
<script>
function contactAdvertiser() {
swal({
title: 'Contact Advertiser',
type: 'info',
html:
'Interested in this product/service? Contact the advertiser!<br> ' +
'<a style="text-decoration: none; color: #FFC107;" href="tel:'.$item->phonenumber.'"><b>Call Advertiser</b></a><br> ' +
'<b><a style="text-decoration: none; color: #536DFE; href="sms:'.$item->phonenumber.'?body=Greetings%2C%20I%20am%20interested%20in%20your%20product%2Fservice%20posted%20on%20OfferMoon.%20$
showCloseButton: true,
confirmButtonText:
'Done',
})
}
</script>
I do not know what is wrong with my code, I have tried many times to fix the "contactAdvertiser function not defined".
UPDATED CODE:
'<a style="text-decoration: none; color: #FFC107;" href="tel:'+ <?php $item->phonenumber ?>+'"><b>Call Advertiser</b></a><br>' +
'<b><a style="text-decoration: none; color: #536DFE; href="sms:'+ <?php $item->phonenumber ?>+'?body=test"</a>' +