A simple function to hide an email address on the web, unless you like spam. Well, do you like spam?
The hideMail function
function hideMail(el, name, site, ext){
var z='mail'+'to';
var str = '<a href="'+z+':'+name+'@'+site+'.'+ext+'"> '+name+'@'+site+'.'+ext+'</a>';
jQuery("."+el).html(str);
}
Parameters
- el
- takes the class name of the element
- name
- The name portion of the email
- site
- The domain portion of the email
- ext
- The extension of the domain
Usage
<span class="info"></span>
<script type="text/javascript">
jQuery(function(){
hideMail("info", "info", "example", "com");
});
</script>
OMG gosh darnit this tut is so OMG amazing. Thank you doosh-zilla