Weird problem with unwrap()
Hi,
I have an img wrapped with <a> when clicking the img 2 things should happen :
- unwrap the <a> tag around the img
- replace the img.
my code looks like this:
-
$imgNext.unwrap('<a>');
$imgNext.attr('src',$imgNext.attr('src').replace('but_next_on','but_next_dis'));
Two strange things happen when this code runs:
- the img is replaced but the unwrap does not work
- if i copy paste the unwrap (so now it is called twice) the unwrap works.
Any ideas?