【问题标题】:How to Click to show & Click to call?如何点击显示和点击通话?
【发布时间】:2017-06-04 16:16:48
【问题描述】:

我正在使用它来点击显示电话号码,但我想在显示电话号码后点击拨打电话。有小费吗?提前致谢!

<span id="number" data-last="123-456-7896"><span>
<a class="see">(718)... Click to show </a></span>

$('#number').click(function() {
$(this).find('span').text( $(this).data('last') );

【问题讨论】:

    标签: javascript jquery tel


    【解决方案1】:

    您需要在点击时插入带有a tel: or a callto: scheme 的链接。

    例如:

    $('#number').click(function() {
        var tel = $(this).data('last');
        $(this).find('span').html( '<a href="tel:' + tel + '">' + tel + '</a>' );
    });
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <span id="number" data-last="+1234567896">
      <span><a class="see">(718)... Click to show </a></span>
    </span>

    【讨论】:

      猜你喜欢
      • 2014-04-06
      • 2016-01-02
      • 2011-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多