Skip to main content

Hello,
i am looking for a JavaScript code to change the label "Specify your own value" at the checkbox list.

It would be nice if someone could help.

 

best regards

Marcel

Hi,


 


Can you provide a screenshot showing what you are trying to achieve?


 




I have two ways to accomplish this:


 


Javascript:


<script>
document.getElementsByClassName("choice-control-item-row ownoption")[0].getElementsByClassName("input-control-text")[0].innerHTML = "test";
</script>

The downside to the above is that the getElementsByClassName returns an array. If you have more than 1 choice controls (configured to display as a checkbox list) in your form, and you want to change the "Specify your own value" text in all the choice controls, then you will need to loop through all the elements returned by the first getElementsByClassName.


 


jQuery:


<script>
$(".choice-control-item-row.ownoption .input-control-text").text("test");
</script>

If you are using the jQuery version, the above will do all the iteration for you. If you have more than 1 choice controls, and you want to change the "Specify your own value" text inside all the choice controls, this piece of script will do it for you without you looping through the choice controls yourself.


 


It Runs
Thank you very much.

Reply