DeFeNdog
DeFeNdog

Reputation: 1210

jQuery Find() not working in Firefox or IE

I'd like to change the attribute of a Google Calendar select element.

The code I'm trying works in WebKit browsers, but not in FF or IE.

Here's what I have:

$jqry('iframe').contents().find('.calendar-nav').attr('style','display: table; background: blue');

I think it's getting stuck on the find() function. Is my iframe being treated as ajax? Is the issue being caused by mime/content type? Please help with a code example if possible.

Many thanks!

Upvotes: 1

Views: 1591

Answers (2)

Muthu Selvam
Muthu Selvam

Reputation: 41

Try this,

Chrome/Firefox:

xml.children[0].childNodes[1].innerHTML

IE8+/Safari:

xml.childNodes[0].childNodes[1].textContent

IE8:

xml.documentElement.childNodes[1].text;

Upvotes: 1

DeFeNdog
DeFeNdog

Reputation: 1210

I found a solution that worked for me. It seems Firefox and IE didn't like the vagueness of having only a tag selector: $('iframe'). As soon as I added a class it worked: $('.myiframe'). I'm guessing an ID would work just the same: $('#myiframe'). I was only using the tag selector because I didn't want to modify the plugin I was using, and it was the only iframe on the page -- oh well. Thanks to those who provided input.

Upvotes: 0

Related Questions