Forum Discussion

danblack's avatar
danblack
Cloud Apps
04-30-2024
Solved

Change Widget Description

Apologies if I've missed it, but has anyone written js for changing the Description section of a widget?  It's the same section of a widget where the edit pencil appears.  I would like to change the ...
  • JeremyFriedel's avatar
    05-15-2024

    Hi danblack 

    Based on the existing script shared at the start of the thread, the below code will only run on the current widget, as it includes the Widget unique OID to the CSS selector, narrowing the scope to the current widget.

     

    widget.on('ready', function (_, env) {
        var color = '#209DBB';
        var fontSize = '20px';
        var fontWeight = 'bold';
    
        var widgetID = env.widget.oid;
    
        var widgetHeader = $('widget-header', `[widgetid='${widgetID}`)
    
        var newCSS = {
            'color': color,
            'font-size': fontSize,
            'font-weight': fontWeight,
        };
    
        widgetHeader.css(newCSS);
    });

     

    The code can be changed as needed, as long as the Widget OID is kept in the CSS selector (in this case used with jQuery), the styling will only be for the current widget.