Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

Change words on toggle component

Hi,
can I change the text on the toggle component from on, off, to yes and no

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Change words on toggle component

Hello! Yes, you can do that using JS

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

Change words on toggle component

Thanks Marina,
I tried this on click, no result, is there something you can see thats wrong

code$("mobiletoggle").click(function(){
$(this).toggleText("Yes", "No").next().toggle();
return false;
});/code

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Change words on toggle component

Try this JS:

codeTiggzi("mobiletoggle1").parent().find(".ui-slider-label-a").text("Yes");
Tiggzi("mobiletoggle1").parent().find(".ui-slider-label-b").text("No");/code

mobiletoggle1 - name of toggle component

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

Change words on toggle component

Hi Marina,
I diddn't get it to work

on mobiletoggle1, click event, run js, entered code, no change?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Change words on toggle component

Hi Michael, apply code on page load event - this will change text on button when page loads.

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

Change words on toggle component

Thanks Folks

Andrés Méndez
Posts: 0
Joined: Thu Apr 18, 2013 6:13 pm

Change words on toggle component

Hello Katya.

I have added the Event, when my page Load, with action Run Javascript, but it didn't work.

I have tried also changing "mobiletoggle" with the name of my toggle, but also doesn't work.

Maybe it is not compatible with this code of my JSON?
codevar toggleValue = value ? "on" : "off&quot
element.val(toggleValue).refresh();

return true;/code

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Change words on toggle component

Make sure 'element' is actually the right element in the DOM. Then, try setting a static value for the label, to see if that works.

Andrés Méndez
Posts: 0
Joined: Thu Apr 18, 2013 6:13 pm

Change words on toggle component

Hello Max.

That code is inside a data association from a JSON. If I change "element" for the name of my real element, the entire page fails.

Return to “Issues”