Any way to add another class in here using Javascript?

In this image this is the whole div in the html I wish to have another <span>

In this span I want it to be called "Kappers" and in the class I want it to hold the variable called ExcelDataSheetPrice is there anyway to add this I have made an attempt but it doesn’t seem to work – anyone got any ideas? (currently running script on tampermonkey)

Any help appreciate it thank you

Here is the whole div

which I would like to add my span underneath the "subContent"

My code

    $('.pagination.next').keyup(function(e){
        if (e.keycode == 39)
        e.preventDefault();
       // var t = document.createElement("style");
        //t.type = "text/css",
        //t.innerText = "\n    .SearchResults.ui-layout-left .listFUTItem {\n        height: 39px;\n    }\n    .SearchResults.ui-layout-left .listFUTItem .label {\n        font-size: 10px;\n  }\n    .SearchResults.ui-layout-left .auction {\n        margin-top: 0 !important;\n        font-size: 12px;\n        top: 4px;\n    }\n",
        //document.head.appendChild(t)
        const div = $('.column');
        div.append('<span class="Kappers">+ExcelDataSheetPrice+</span>')
        setTimeout(function(){
            getPlayerDataFromSite();
        }, 500);
    });
}

5 thoughts on “Any way to add another class in here using Javascript?”

  1. Try this with JavaScript

    document.querySelector(".pagination .next").onkeyup = () => {
    if (e.keycode === 39) {
    document.querySelector(".column").innerHTML += '<span class="Kappers">' +ExcelDataSheetPrice+ '</span>';
    setTimeout(() => {
    getPlayerDataFromSite();
    }, 500);
    }
    });
    

    Try Now With This If Got Error Give Me Details

    Reply
  2. $('.pagination.next').keyup(function(e){
        if (e.keycode == 39)
          e.preventDefault();
        const div = $('.column'); // watch out for your spelling error (coloum)
        div.append('<span class="Kappers">+ExcelDataSheetPrice+</span>');
        // do stuff
    });
    

    Tips for the future:

    Press F12 to open your developer console and try to debug your script by inspecting your code, step-by-step.

    Maybe use console.log() to find the error.

    Reply

Leave a Comment