getElementsByClassName and IE

Go down

getElementsByClassName and IE

Post by TamDonCo on March 6th 2018, 2:47 pm

Hi All

I have the script that's using getElementsByClassName but this object is not supported by IE, it works on other browsers

Does IE have equivalent function like getElementsByClassName ?


Code:



  for ( var i = 0, r = document.getElementsByClassName('row'); i < r.length; i++ ) {
        // codes here
  }

avatar
TamDonCo
Forumember

Posts : 338
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Re: getElementsByClassName and IE

Post by Draxion on March 6th 2018, 4:16 pm

Hi.

That isn't supported by IE older than 8, use this instead.
Code:
document.querySelectorAll('.classname')


NEVER provide your founder's account or email
Please provide forum's URL when dealing with design and appearance issues
Don't forget to mark the topic as when the issue is resolved. This helps the staff greatly.
PM Support is prohibited!
TOS | General Rules | FAQ | Tricks & Tips | Latest Updates | Introduce Yourself

avatar
Draxion
Support Moderator
Support Moderator

Male Posts : 2144
Reputation : 273
Language : English
Location : USA

http://www.draxionsgameden.com/

Back to top Go down

Re: getElementsByClassName and IE

Post by TamDonCo on March 6th 2018, 5:17 pm

@Draxion wrote:Hi.

That isn't supported by IE older than 8, use this instead.
Code:
document.querySelectorAll('.classname')

Thank You , how about getElementsByTagName ?


Code:


    var  r = document.getElementsByClassName('topic-title');
    var str = r[0].getElementsByTagName('a')[0].text;
    console.log(str);


avatar
TamDonCo
Forumember

Posts : 338
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Re: getElementsByClassName and IE

Post by Draxion on March 6th 2018, 5:20 pm

Use this.
Code:
getElementsByTagName("type").firstChild.data;


NEVER provide your founder's account or email
Please provide forum's URL when dealing with design and appearance issues
Don't forget to mark the topic as when the issue is resolved. This helps the staff greatly.
PM Support is prohibited!
TOS | General Rules | FAQ | Tricks & Tips | Latest Updates | Introduce Yourself

avatar
Draxion
Support Moderator
Support Moderator

Male Posts : 2144
Reputation : 273
Language : English
Location : USA

http://www.draxionsgameden.com/

Back to top Go down

Re: getElementsByClassName and IE

Post by TamDonCo on March 6th 2018, 7:16 pm

Thanks but still does not work

here my simple function

Code:


$(document).ready(function($){


  var  r = document.getElementsByClassName('topic-title');

  var str = r[0].getElementsByTagName('a')[0].text;

  console.log(str);


});

avatar
TamDonCo
Forumember

Posts : 338
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Re: getElementsByClassName and IE

Post by SLGray on March 6th 2018, 7:38 pm



When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.

avatar
SLGray
Administrator
Administrator

Male Posts : 43493
Reputation : 3094
Language : English
Location : United States

http://fmthemesdesignteam.forumotion.com/

Back to top Go down

Re: getElementsByClassName and IE

Post by TamDonCo on March 6th 2018, 8:23 pm

Thank You everyone

I think I have firewall, I will test at home to see it works
avatar
TamDonCo
Forumember

Posts : 338
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Re: getElementsByClassName and IE

Post by TamDonCo on March 7th 2018, 3:05 pm

Mod : please delete this topic , I think because of firewall
avatar
TamDonCo
Forumember

Posts : 338
Reputation : 2
Language : English

http://nhomcho.forummotion.com/

Back to top Go down

Re: getElementsByClassName and IE

Post by Draxion on March 7th 2018, 3:37 pm

Locked as requested.


NEVER provide your founder's account or email
Please provide forum's URL when dealing with design and appearance issues
Don't forget to mark the topic as when the issue is resolved. This helps the staff greatly.
PM Support is prohibited!
TOS | General Rules | FAQ | Tricks & Tips | Latest Updates | Introduce Yourself

avatar
Draxion
Support Moderator
Support Moderator

Male Posts : 2144
Reputation : 273
Language : English
Location : USA

http://www.draxionsgameden.com/

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum