Skip to content

Latest commit

 

History

History
58 lines (37 loc) · 1.46 KB

public-methods.md

File metadata and controls

58 lines (37 loc) · 1.46 KB

Cleave.js Documentation

Documentation > JavaScript API > Public methods

.getRawValue()

Gets raw value without any format pattern or delimiter, normally you should pass over this value to model or backend.

cleave.getRawValue();

.setRawValue(value)

Sets raw value, it will then apply formatting automatically.

cleave.setRawValue('5555444433332222');

.getFormattedValue()

Gets formatted pretty value, this is same as DOMInputElement.value.

cleave.getFormattedValue();

.getISOFormatDate()

Gets ISO format date value, this only works for date input type.

cleave.getISOFormatDate();

.destroy()

Garbage collection, removes all listeners.

cleave.destroy();

.setPhoneRegionCode(regionCode)

Sets / Changes country region code.

You will only need to call this when dealing with country switching for a phone input field.

e.g. user selected a different country option via <select>, which triggered the country change. See more in documentation phone lib addon section.