jQuery code works in Firebug, but not on its own
- by Ben
I'm having quite the brainbuster of an issue right now. I am trying to change a link's hash tag at the end from "respond" to "comments" with jQuery. I have a simple script that should do this, however it does not work. The link does not change. However, Firebug shows no errors and when I run the code in Firebug's console, it works just as I intend. Why doesn't this work on its own? Does anybody have a solution, I'm at my wits edge with this one.
(function ($) {
$(document).ready(function() {
$("a[href$='respond']").each(function() {
$(this).attr("href", $(this).attr('href').replace("respond", "comments"));
});
});
})(jQuery.noConflict());
Thanks so much, I know this might be a pain to test but I'm really thankful.