JSFiddle - React, Tailwind, and code Playground

HTML

<input type="file" id="file" />
<input type="button" id="submit" value="Submit" />
<br/>
<br/>

<input type="text" id="output" />
<input type="text" id="output1" />

JavaScript

$('#submit').click(function() {
    var files = $('#file')[0].files;
    var reader = new FileReader();
    reader.onload = function() {
        var xml = $.parseXML(this.result);
        $(xml).find('cat').each(function() {
        	var catName = $(this).find('name').text();
            console.log(catName);
            $('#' + this.id).val(catName);
        })
    };
    reader.readAsText(files[0]);
});