1

I'm using javascript inside the console of Firefox and this method does not work as well as 'getElementsByClassName()'. I specifically added class attribute to my tags in order to access. Could someone help me?

I'm trying to use those methods to get tags inside a modal list new form.

Sharepoint 2010, Firefox 31.5.3

  • Use document.getElementsByClassName if you have added a class for selecting. I doubt the tag names are specific enough for you to be useful without further filtering. – James Love Nov 16 '15 at 14:33
  • I do use both of them without any results. getElementsByClassName('myclass'), getElementsByClassName("myclass"), getElementsByTagName('select') all of them return an empty Htmlcollection. I can see my 'select' tag when looking at the dom as well as my class 'myclass'... – ameliapond Nov 16 '15 at 14:43
  • 1
    Try document.querySelectorAll("<class name here>")...then loop over the collection. See if that works. – psdpainter Nov 16 '15 at 15:02
  • 4
    Hang on, OP has mentioned a "modal list new form", this is rendered within in IFrame if I remember right - can someone check that getElementsBy... work from a parent frame into a child iframe? – James Love Nov 16 '15 at 15:05
  • Tank you James Love it was that. Obviously, I have to first get the IFrame and then access the children. – ameliapond Nov 16 '15 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.