-1

I want handle on event paste but I using onpaste It's not working

<lightning:input type="text" aura:id="FName" value="Test" maxlength="25" name="f-name" label="First Name" required="true" onchange="{! c.countChars}"  onpaste="{! c.pasteEvent}"/>
0

2 Answers 2

2

You can access the DOM element that the lightning component creates in the renderer. This allows you to work with the underlying DOM events for cases where the Lightning Component framework doesn't (presently) provide support. Though how useful this is depends on exactly what you want to do.

Simplest example:

({
    afterRender: function(component, helper) {
        this.superAfterRender();
        var c = component.find('FName');
        c.getElement().addEventListener('paste', function() {
            console.log('pasted');
        });
    }
})
3

Please refer lightning:input.

onpaste event(attribute) is not available for lightning:input.

If you need such functionality, you may go for ui:inputText component and add your desired slds-class.

Refer Events section in the following resource ui:inputText

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .