Add Attributes to submit button

Add Attributes to submit button

Andreas S.Andreas S. Posts: 190Questions: 68Answers: 4

I tried to add some Attributes to the submit Button, but is seems, it doesn't work. I used attr option to add an attribute to the submit Button. Is there an other way to add it?
my Code:

$( '#usr-signin' ).on( 'click', function() {
   auth
    .title( '<i class="fad fa-sign-in-alt txt-Orange"></i> <span class="txt-Orange bold">' + frmInfo.s_title + '</span>' )
    .buttons( [
    { label: frmInfo.login, 
        attr: { 
          id: 'sbtn',
          'data-sitekey': '2344'
        },
        action: function( dt ) {
                this.submit(
                    function( dt ) {
            pushNotify( dt.data.type, frmMsg.login_title, frmMsg.login_text );
            setTimeout( function() {
              window.location.href = 'index.php';
            }, 2000 );
                    },
                    function( dt ) {
            console.log( dt );
                    },
                    function( dt ) {
                        dt.response = gresponse;
                    }
                );
            }, className: 'btn-Orange' },
            { label: frmInfo.cancel, action: function() { this.close(); }, className: 'btn-WhiteSmoke ml-10' }
        ] )
        .edit();
.....

Andreas

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 54,921Questions: 1Answers: 8,611 Site admin
    Answer ✓

    Hi Andreas,

    There is no attr option for Editor buttons at the moment I'm afraid. It could readily be added with a little tweak in the buttons() method though:

    var attr = btn.attr || {};
    

    then in the setup chain:

    .attr(attr)
    

    Allan

Sign In or Register to comment.