I'm new to jQuery and I need to replace a part of an A HREF attribute in a link. More specifically, a piece of code that will remove the "-h" from "s1600-h" for a lightbox application:
In other words, turn s1600-h to s1600
Also, do I need to use $(function()
or $(document).ready(function()
before the piece of code?
$(document).ready(function(){
$('a').each(function(){
this.href = this.href.replace('s1600-h', 's1600');
});
});