javascript - Changing button value on button click -
just starting out in xpages , ran silly problem:
i have button (id- "button2") , has label "aaa". i'm trying change value of button on button click value "kappa123". i've included javascript in "client" tab in script editor.
javascript:
var elem = document.getelementbyid("button2"); if (elem.value=="aaa") elem.value="kappa123"; else elem.value = "aaa";
i don't error , nothing happens. doing wrong?
use
var elem = document.getelementbyid("#{id:button2}"); if (elem.innerhtml=="aaa") elem.innerhtml="kappa123"; else elem.innerhtml = "aaa";
you can't use element id in client side code direct id gets "renamed" xpages. #{id:button2}
rendered id.