[jQuery] Help with button script
I'm trying to implement some code I found here - basically just trying
to learn more about jQuery:
http://monc.se/kitchen/59/scalable-css-buttons-using-png-and-background-
colors#comment-15755
$('.btn').each(function(){
var b = $(this);
var tt = b.text() || b.val();
if ($(':submit,:button',this)) {
if (this.href) {
b =
$('').insertAfter(this).addClass(this.className).attr('id',this.id).attr
('href',this.href);
} else {
b =
$('').insertAfter(this).addClass(this.className).attr('id',this.id);
}
$(this).remove();
$('#'+this.id).click(function(){$(this).parents('form').submit();});
}
b.text('').css({cursor:'pointer'}).
prepend('').append($("").text(tt).append(""));
});
This is throwing a "Node cannot be inserted at the specified point in
the hierarchy" code: "3" error and I'm stuck and not sure how to debug -
I'm using Firebug but haven't been able to pull anything useful. I'm
using jQuery 1.2.1.
Any ideas what is wrong?
Thanks,
Jim