I'm developing a website and am in one of those wonderful stages where everything works perfectly in Chrome, Safari, Firefox (both for windows and mac) and then you need to spend an extra 24 hours fixing it for IE.
I've wrestled with it for ages, but the last thing that is happening is a variable is constantly 'undefined' in IE7.
It is coming from an html5 data attribute called data-title
.
I've looked around and have also tried the solutions offered in both this and this stackoverflow questions.
Thus, I have tried
$(this).attr('data-title');
and
$(this).data('title');
and regarding the last solution
var newTitle = $(this).getAttribute("data-title");
I get an error:
Uncaught TypeError: Object [object Object] has no method 'getAttribute'
The thing is, I can't load the variable with getElementById because the elements are generated by jQuery Maximage
The element generated looks like this:
<div class="mc-image collection-image" title="" style="background-image: url(http://www.server.com/image.jpg); position: absolute; top: 0px; left: 0px; z-index: 12; opacity: 1; display: block; width: 1292px; height: 670px; " data-title="The Title" data-href="#collection-description-172"></div>
I am using the data-title
attribute to set the text in another div on the side when maximage/jQuery cycle changes the image.
I am at a complete loss.