Also, how can I check if the checkboxes are clicked, as using those conditions, I have to perform operations further? I’ve tried using the following code-
if($w(`#radio1click`).checked{
//perform operation
}
I also tried this-
$w('#radio1click').onChange((event) => {
if (event.target.checked) {
//perform operations
}
Can anyone please help me understand why these are not working?
You’re missing closing parenthesis on your if statement after ‘checked’. That might be your issue.
Both of your provided codes do have errors…
- first one…
if($w(`#radio1click`).checked) {
start_myFunction();
}
- second one…
$w('#radio1click').onChange((event)=> {
if (event.target.checked) {//perform operations}
});
Everytime, when you open a → ( or [ or { ----> you also have to close it → ), ], } !!!
Furthermore…
$w.onReady(()=>{
$w('#radio1click').onChange((event)=> {
if (event.target.checked) {//perform operations}
});
});
Hey, thank you all for responding! I tried putting the semicolon in the code, and yes it was under the onReady function, I just did not mention it in here, So now the code looks like this-
$w ( ‘#radio1click’ ). onChange (( event ) => {
if ( event . target . checked ) {
$w ( ‘#iltInput’ ). onChange (( event ) => {
const enteredValue = event . target . value ;
$w ( ‘#summarycourse’ ). value = enteredValue ;
})
// Perform any actions you want when the radio button is clicked
}
});
This is a bit modified version of the code. Bascially what I am trying to do here is, there’s a radio button, upon clicking which the user’s can see a text box that appears (I’ve used multistate boxes for this) and they need to add their input according to that particular option. Now, I need to take this input and display in it the summary in the last state of the multi-state box. Thus, I’ve added a condition that if the particular option is clicked, take that input and allot this value to the text box that is present in the last state of the whole multi-state. But this code doesn’t work. is there any silly mistake that I’m making again? Could you please help me in this?