The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript getElementsByClassName() to modify the Label Text

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #207719
    Kevin Mamaqi


    I’m trying to figure out how to modify a label text using JavScript. The label has a class name, which I’m using to get it and modify, but no success yet. This is the code that I’m using:

    Any idea on how to make it work?

    Kevin Mamaqi

    Well, I came up with this, which I don’t know if it is the best solution but it works:

    var selectFunction = function() {
        document.getElementsByClassName('cat-item cat-item-19')[0].getElementsByTagName("label")[0].innerHTML = '<input type="checkbox" name="oftipodevideo[]" value="19"> Live';
        document.getElementsByClassName('cat-item cat-item-20')[0].getElementsByTagName("label")[0].innerHTML = '<input type="checkbox" name="oftipodevideo[]" value="20"> Official';

    Thanks for your help.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.