Clean fields

Hello all. I have a question please.

This is my page :

I fill in the fields and everything works when I press the button. It creates well the data in the database (Yippee!:slight_smile:

My question is: what code to add so that when I validate by pressing the button, it empties the form fields, please.

Thanks in advance for your help

Here is the basic code of my page:

import wixData from 'wix-data';
export function save() {
//
wixData.query('Artistes')
.eq('title', $w('#input1').value)
.find()
.then(res => {
let firstItem = res.items[0];
let toInsert = { "artiste": firstItem._id, "inputArtist": $w("#input1").value, "eurovision": $w("#input10").value, "gentv": $w("#input9").value, "bof": $w("#input8").value, "comedie": $w("#input6").value, "title": $w("#input2").value, "annee": $w("#input3").value, "languePrincipale": $w("#input4").value, "duo": $w("#input5").value, "live": $w("#input7").value };
console.log(toInsert);
wixData.insert("Titres", toInsert)
.then((results) => {
console.log(results);
})
.catch((err) => {
console.log(err);
});
});
}

Sorry for my english, I’m french

You might be easier just to have a simple clear or reset button and this has been asked in previous forum posts like here.
https://www.wix.com/corvid/forum/community-discussion/reset-button-search
https://www.wix.com/corvid/forum/community-discussion/reload-page-and-clear-reset-filters

It doesn’t work. Where’s my mistake? (In orange color)

In the button’s properties, at “onClick”, I put “clear”

Does my button need to be linked to my database?

import wixData from 'wix-data';
export function button2_click(event, $w) {

$w("#input1").selectedIndex = 0;
$w("#input2").selectedIndex = 0;
$w("#input3").selectedIndex = 0;
$w("#input4").selectedIndex = 0;
$w("#input5").selectedIndex = 0;
$w("#input6").selectedIndex = 0;
$w("#input7").selectedIndex = 0;
$w("#input8").selectedIndex = 0;
$w("#input9").selectedIndex = 0;
$w("#input10").selectedIndex = 0;

}
export function save() {
//
wixData.query('Artistes')
.eq('title', $w('#input1').value)
.find()
.then(res => {
let firstItem = res.items[0];
let toInsert = { "artiste": firstItem._id, "inputArtist": $w("#input1").value, "eurovision": $w("#input10").value, "gentv": $w("#input9").value, "bof": $w("#input8").value, "comedie": $w("#input6").value, "title": $w("#input2").value, "annee": $w("#input3").value, "languePrincipale": $w("#input4").value, "duo": $w("#input5").value, "live": $w("#input7").value };
console.log(toInsert);
wixData.insert("Titres", toInsert)
.then((results) => {
console.log(results);
})
.catch((err) => {
console.log(err);
});
});
}
export function clear(event) {
//Add your code for this event here:
}