$(document).ready(function(){ $('.social-media-links a').each(function(){ this.href = this.href.replace('#', '%23'); }); });