I have an image title that has a tag with double quotes in it, and I need to convert it to single quotes for use in a photo slideshow. I don't have the option of changing anything other than the attribute name, so I can't escape the quotes inside the value.
Here's my html:
<div id="image-gallery">
<img alt="Alt Text" src="photo.jpg" title="Title <a href="#link">here</a>" />
</div>
I've tried grabbing the title and using replace to change the double quotes to single quotes, like so:
mystr=string = $("#image-gallery img").attr('title');
mystr=mystr.replace(/\"/g,'\'');
The title still drops off after the first double quote though. Any ideas?
Thanks!