0

I'd like to know if there's is any tag in within aura components markup, that deletes the current value upon click.

Field Example

In the above image, the user will click on the last two fields, and fill them with the current value of the product. In the moment the user clicks on the field with the $14,56 value, it should disappear without the user hitting backspace or delete keys on the keyboard.

Thanks in advance!!

1

You can use an onclick handler. Here's a demo you can copy-paste.

<aura:application extends="force:slds">
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
    <lightning:input type="currency" label="Demo" onclick="{!c.clear}" aura:id="demo" />    
</aura:application>

({
    init: function(c, e, h) {
        c.find("demo").set("v.value", 14.56);
    },
    clear: function(c, e, h) {
        c.find("demo").set("v.value", null);
    }
})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.