Search code examples
jquerytel

Jquery table append with a href tel


I show user gsm number but I want to change it to callable.But this now work what should I do?

      $("#infoList").append("<tr><td><img src='"+urlIMG+"' height='50' width='50'>
</img></td><td> <a href="'tel:item.GSM'" >'+item.GSM+'</a> </td> </tr>");

Solution

  • there are some syntax errors in your code

    js code:

     $(document).ready(function () {
            var item = {
                GSM: "223432"
            };
            var urlIMG = "https://png.icons8.com/metro/1600/phone.png"
            $("#infoList").append("<tr><td><img src='" + urlIMG + "' height='50' width='50'></img></td><td> <a href='tel:" + item.GSM + "'>" + item.GSM + "</a> </td> </tr>");
    
        });
    

    code: https://codepen.io/peker-ercan/pen/xywWVK