Last active
March 9, 2018 10:28
-
-
Save ciaranmahoney/d568e010e0b424ac90e7 to your computer and use it in GitHub Desktop.
Click to Show Full Phone Numer - Jquery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<span id="clickToShow">xxx-xxx-xxxx</span> | |
<script> | |
var shortNumber = $("#clickToShow").text().substring(0, $("#clickToShow").text().length - 5); | |
var onClickInfo = "_gaq.push(['_trackEvent', 'EVENT-CATEGORY', 'EVENT-ACTION', 'EVENT-LABEL', VALUE, NON-INTERACTION]);"; | |
$("#clickToShow").hide().after('<button id="clickToShowButton" onClick="' + onClickInfo + '">' + shortNumber + '... (click for full phone number)</button>'); | |
$("#clickToShowButton").click(function() { | |
$("#clickToShow").show(); | |
$("#clickToShowButton").hide(); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment