Jump to content
MBhalli

Changing Background color of a radio button

Recommended Posts

How can I invoke an "onclick" event for a radio button of two choices Yes or No. 

<script type= "text/javascript">
function ValueChanged()
{
alert("Function Called");
if(document.getElementById("InsertRecordMetalic_Injury")[1].checked == true;){
document.getElementById("InsertRecordPrior_Surgery")[1].style.background = "yellow";
}
document.getElementById("InsertRecordPhone").focus();

}

document.getElementById("InsertRecordPrior_Surgery")[1].onclick= ValueChanged;

</script>

Share this post


Link to post
Share on other sites

The ID of a radio button does not seem to be correct. Refer to

It should be something like, InsertRecordMetalic_Injury0, InsertRecordMetalic_Injury1 ....

Also you do not need == true

 

 <script type= "text/javascript">
function ValueChanged()
{
alert("Function Called");
if(document.getElementById("InsertRecordMetalic_Injury0").checked){
document.getElementById("InsertRecordPrior_Surgery0")0.style.background = "yellow";
}
document.getElementById("InsertRecordPhone").focus();

}

document.getElementById("InsertRecordPrior_Surgery0").onclick= ValueChanged;

</script> 

But I am not sure how to change the background color

Share this post


Link to post
Share on other sites

Thank you so much for directing me to the "Caspio form element" Page. I'm not able to change the background color of a radio button, but I have added some animation to reflect a radio button click event. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...