annotorious / annotorious-v2-plugins

Plugins compatible with the RecogitoJS, Annotorious and AnnotoriousOSD annotation libraries
BSD 3-Clause "New" or "Revised" License
28 stars 20 forks source link

is it possible to add attributes to the buttons inside a9s-toolbar #43

Closed the-yaz closed 8 months ago

the-yaz commented 8 months ago

I'm trying to add attribute type to the buttons so i can use them inside a form , i try a function in js that collect all btns and set attributes but not wroking well even to select a9s-toolbar most of the time be null or undefined or as empty "HTMLCollection []" , do you have any suggestions?

function modifyButtons() {
        // Check if the container and toolbar exist
        var container = document.getElementsByClassName('.a9s-toolbar');
        if (container) {

                console.log(".a9s-toolbar")
                var buttons = toolbar.querySelectorAll('.a9s-toolbar-btn');

                // Add type="button" to each button
                buttons.forEach(function(button) {
                    button.setAttribute('type', 'button');
                });

        }
    }
the-yaz commented 8 months ago

I downloaded the source code and then modify it by adding a.setAttribute("type","button").