简体   繁体   中英

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). 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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