Skip to main content
Nintex Community Menu Bar
Solved

JavaScript code to change the label "Specify your own value"

  • March 11, 2020
  • 4 replies
  • 326 views

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

Best answer by boringNerd1

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.


 

4 replies

Forum|alt.badge.img+15

Hi,


 


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


 


  • Author
  • March 13, 2020


Forum|alt.badge.img+15
  • Answer
  • March 16, 2020

I have two ways to accomplish this:


 


Javascript&colon;


<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.


 


  • Author
  • March 16, 2020
It Runs
Thank you very much.