How do I add a div between buttons?

How do I add a div between buttons?

bbilalbbilal Posts: 3Questions: 2Answers: 0
edited April 2020 in Free community support

Hi community,

Is it possible to add a div or span between buttons?

Right now the structure rending in HTML is:

<div class="dt-buttons">          
    <button class="dt-button buttons-copy buttons-html5 btn btn-export" tabindex="0" aria-controls="data-table" type="button"><span>Copy to clipboard</span></button> 
    <button class="dt-button buttons-excel buttons-html5 btn btn-export" tabindex="0" aria-controls="data-table" type="button"><span>Export as Excel</span></button> 
    <button class="dt-button buttons-csv buttons-html5 btn btn-export" tabindex="0" aria-controls="data-table" type="button"><span>Export as CSV</span></button> 
    <button class="dt-button buttons-pdf buttons-html5 btn btn-export" tabindex="0" aria-controls="data-table" type="button"><span>Export as PDF</span></button> 
    <button class="dt-button buttons-print btn btn-export" tabindex="0" aria-controls="data-table" type="button"><span>Print</span></button>
</div>

The desired result is:

<div class="dt-buttons">          
    <button class="dt-button buttons-copy buttons-html5 btn btn-export" tabindex="0" aria-controls="data-table" type="button"><span>Copy to clipboard</span></button>
    <span class="dot"></span>
    <button class="dt-button buttons-excel buttons-html5 btn btn-export" tabindex="0" aria-controls="data-table" type="button"><span>Export as Excel</span></button> 
    <span class="dot"></span>
    <button class="dt-button buttons-csv buttons-html5 btn btn-export" tabindex="0" aria-controls="data-table" type="button"><span>Export as CSV</span></button> 
    <span class="dot"></span>
    <button class="dt-button buttons-pdf buttons-html5 btn btn-export" tabindex="0" aria-controls="data-table" type="button"><span>Export as PDF</span></button>
    <span class="dot"></span>
    <button class="dt-button buttons-print btn btn-export" tabindex="0" aria-controls="data-table" type="button"><span>Print</span></button>
</div>

Answers

  • bbilalbbilal Posts: 3Questions: 2Answers: 0

    I solved is using:

     $("button:not(:last)").after("<span class='dot'>");
    

    If it helps someone else.

This discussion has been closed.