I have the following code:
FForm.prototype._addControls = function() {
// main controls wrapper
this.ctrls = createElement( 'div', { cName : 'fs-controls', appendTo : this.el } );
// continue button (jump to next field)
**this.ctrlContinue = createElement( 'button', { cName : 'fs-continue', inner : 'Proxima', appendTo : this.ctrls } );**
this._showCtrl( this.ctrlContinue );
// navigation dots
if( this.options.ctrlNavDots ) {
this.ctrlNav = createElement( 'nav', { cName : 'fs-nav-dots', appendTo : this.ctrls } );
var dots = '';
for( var i = 0; i < this.fieldsCount; ++i ) {
dots += i === this.current ? '<button class="fs-dot-current" ></button>' : '<button disabled></button>';
}
this.ctrlNav.innerHTML = dots;
this._showCtrl( this.ctrlNav );
this.ctrlNavDots = [].slice.call( this.ctrlNav.children );
}
// field number status
if( this.options.ctrlNavPosition ) {
this.ctrlFldStatus = createElement( 'span', { cName : 'fs-numbers', appendTo : this.ctrls } );
// current field placeholder
this.ctrlFldStatusCurr = createElement( 'span', { cName : 'fs-number-current', inner : Number( this.current + 1 ) } );
this.ctrlFldStatus.appendChild( this.ctrlFldStatusCurr );
// total fields placeholder
this.ctrlFldStatusTotal = createElement( 'span', { cName : 'fs-number-total', inner : this.fieldsCount } );
this.ctrlFldStatus.appendChild( this.ctrlFldStatusTotal );
this._showCtrl( this.ctrlFldStatus );
}
// progress bar
if( this.options.ctrlProgress ) {
this.ctrlProgress = createElement( 'div', { cName : 'fs-progress', appendTo : this.ctrls } );
this._showCtrl( this.ctrlProgress );
}
}
Note that there is createElement
creating button
.
I need some code to run in the event when I click on this element that was created, what should I do?
Here has a demo of the example I'm using.