may88seiji
7/22/2017 - 8:59 AM

tel

tel

var ua = navigator.userAgent;
  if ( ua.indexOf('iPhone') > 0 || ua.indexOf('Android') > 0 ) {
  $('.tel').each(function() {
    var txt = $(this).text();
    $(this).parent().html($('<a>').attr('href', 'tel:' + txt.replace(/-/g, '')).append(txt + '</a>'));
  });
}
//<p><span class="tel">090-0000-0000</span></p>
//<p><a href="tel:090-0000-0000">090-0000-0000</a></p>

var ua = navigator.userAgent;
  if ( !(ua.indexOf('iPhone') > 0 || ua.indexOf('Android') > 0) ) {
  $('a[href^="tel:"]').each(function() {
    var txt = $(this).text();
    $(this).parent().html('<span>' + txt + '</span>');
  });
}