A simple question about how to call "Select from a list of options" in a js file

How to call the select from a list of options in a js file?
This is the HTML file:

<script type="text/javascript">
    RED.nodes.registerType('testnode', {
        category: 'output',
        color: '#006738',
        defaults: {
            name: {value: ""},
            test: {value: ""},
        },
        inputs: 1,
        outputs: 1,
        paletteLabel: "testnode",
        label: function () {
            return (this.name || 'testnode');
        },
        oneditprepare: function () {
            $('#node-input-test').typedInput({
                types: [ 'test',
                value: "test",
                options:[
                {value: "01", label: "Options 1"},
                {value: "02", label: "Options 2"},
                {value: "03", label: "Options 2"},
                {value: "04", label: "Options 4"},
                ]
            });
        }
    });
</script>

This is the JS file:

module.exports = function (RED) {
    function testnodeNode(config) {
        RED.nodes.createNode(this, config);

        let node = this;
        let test = config.test;
        
        node.on("input", function (msg) {
            let str = msg.payload.toString("hex");
            
            let sum = parseInt("xxxx", 16) + parseInt(test, 16);

            if(str == "xxxx" + test + sum.toString(16){
                msg.payload = "test" + test;

                node.send(msg);            
               });
            }
        });
    }
    RED.nodes.registerType("testnode", testnodeNode);
}

Which needs to use the msg.payload from the previous node and call the selected option value for comparison and output the final result.
The options called in the above js file are invalid.
How can the selected option value be called in the JS file?
Any help would be greatly appreciated!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.