简体   繁体   English

防止电话尝试在点击时拨打电话-Rails,JavaScript

[英]Preventing phone from trying to call number on click - Rails, JavaScript

In one view of my Rails app, there's is a signature block that the user can click to edit (it opens up a modal where they can change the text). 在我的Rails应用程序的一个视图中,有一个签名框,用户可以单击该框进行编辑(它打开了一个模版,用户可以在其中更改文本)。 Part of the signature block is the user's phone number. 签名块的一部分是用户的电话号码。 When using the app on mobile, if the user clicks on the phone number part of the signature block, the phone tries to call that number. 在移动设备上使用该应用程序时,如果用户单击签名栏的电话号码部分,则电话将尝试呼叫该号码。 The same is happening for the email part of the signature block (this one takes the user to their email app in order to allow them to send an email). 签名块的电子邮件部分也发生了同样的情况(这一过程将用户带到他们的电子邮件应用程序,以便允许他们发送电子邮件)。 How do I prevent these two from happening? 如何防止这两种情况发生? If the user clicks anywhere in the signature block, I want just for the modal to pop up. 如果用户单击签名块中的任何位置,我只希望弹出模式。

I would check out the event.preventDefault() function. 我将检查event.preventDefault()函数。

https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault https://developer.mozilla.org/zh-CN/docs/Web/API/Event/preventDefault

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM