function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Herish SurendranHerish Surendran 

I am working in LWC and facing an issue.

A table in componentName.html
 
<table style="border-collapse: collapse; width: 100%;">
                                <tr>
                                    <td style="border: 1px solid grey; text-align: left; padding: 8px;">
                                        <input type="radio" id="Phone" name="verificationMethod" value={phone} onchange={selectMethod}/>
                                        <label class="slds-text-heading_small">&nbsp;{phone}</label>
                                    </td>
                                </tr>
                            </table>

componentName.js
 
selectMethod(event){
        this.selectedMethod = event.target.id;
    }

When the select method executes, the value of selectedMethod property becomes Phone-57 instead of Phone.

So I changed the function to 
 
selectMethod(event){
        this.selectedMethod = event.target.id.replace('-57','');
    }

Can anyone please tell why this is happening.
Mohamed IthrisMohamed Ithris
Hi Herish,
Why you Assign the this.selectMethod  to value? it should be Variable which you want to display in the HTML Table.
Hope below You are Expecting? if any let me know

LWC HTML:
<template>
<lightning-input value ="Phone" type="radio" onchange={handleChange} label="Enter a fruit name"></lightning-input>
{Newphone}
</template>

LWC JS :
export default class App extends LightningElement {
phone;
Newphone;
handleChange(event) {
this.phone = event.target.value;
this.Newphone = this.phone + " - 57";
console.log(this.Newphone );
}
}