PennController for IBEX › Forums › Support › Several questions about the TextInput element › Reply To: Several questions about the TextInput element
November 15, 2021 at 1:09 pm
#7501
Jeremy
Keymaster
Hello,
The expression $("#alter")
is a jQuery expression, where you can select an element by targeting its id
attribute in the string simply by prefixing a #
character. Your input element’s id being “sum”, you can get a jQuery object pointing to it using $("#sum")
You can use a Function element to dynamically test the value of that input element in the Button’s wait
command:
newButton("Continue")
.print()
.wait(
getHtml("demographics").test.complete()
.failure( getHtml("demographics").warn() )
.and(
newFunction(()=>$("#sum").val())
.test.is(100)
.failure( newText("must be 100").print() )
)
)
(Note that your original code has getHtml("consent")
where it should have getHtml("demographics")
)
Jeremy