Bootstrap Badge Generator

Create Bootstrap 4 badge markup by choosing a contextual style, pill shape and text. The preview and generated code update automatically.

Preview

Generated HTML

Generator Logic Top ↑

function updateBadge() {
    const classes = [
        "badge",
        "badge-" + $( "#badge-style" ).val()
    ];

    if ( $( "#badge-pill" ).prop( "checked" ) ) {
        classes.push( "badge-pill" );
    }

    const $badge = $( "<span>", {
        class: classes.join( " " ),
        text: $( "#badge-text" ).val()
    });

    $( "#badge-preview" ).empty().append( $badge );
    $( "#badge-code" ).text( $badge.prop( "outerHTML" ) );
}

Additional Original Learning Routes Top ↑






plus2net.com






We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2026   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer