If you are using the onChange handler function. Then you can get the value of the data-'format' easily. You are just required to pass on the event parameter. Then we have a dataset property using which we can get all the data-'format' declared in that tag. Dataset gives back a key value pair object containing custom attribute and its value.
const inputtag=document.getElementById("input_value")
const handleChange=(e)=>{
const customAttributes=e.target.dataset
/*customAttributes containes the attributes you defined, in key value pair*/
console.log(customAttributes)
/* example
customAttributes = {
"input": "value1",
"value": "value2"
}
*/
}
inputtag.addEventListener('change',handleChange,true)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<input id='input_value' data-input='value1' data-value='value2' type='text' placeholder='write here'/>
</body>
</html>
Note, we can get custom attributes data using onClick function too, all the logic will stay as it is.
In case of input tags, we can prefer onChange while we can use onClick for other tags.
e.getAttribute("blah")for plain attributes, ore.dataset.blahfor data attributes.