Skip to content

Instantly share code, notes, and snippets.

@k-ish
Last active June 14, 2019 09:48
Show Gist options
  • Save k-ish/ad611357bc65b00c7db363424de3b75f to your computer and use it in GitHub Desktop.
Save k-ish/ad611357bc65b00c7db363424de3b75f to your computer and use it in GitHub Desktop.
スマホの電話リンク
<span class="tel_link">090-5555-6666</span>
// スマホの電話リンク
var ua = navigator.userAgent;
if(ua.indexOf('iPhone') > 0 || ua.indexOf('Android') > 0){
$('.tel_link').each(function(){
var str = $(this).text();
$(this).html($('<a>').attr('href', 'tel:' + str.replace(/-/g, '')).append(str + '</a>'));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment