My question might seem trivial but I can't find resources about selecting elements that are descendant of a given element.
I have a form in which I want all fields (they should be all the input
s and select
s that are child of the form
tag, except buttons) to submit the form when ENTER key is pressed. Actually I require to call a custom Javascript method to submit the form, instead of merely submitting it the plain old way.
This because I need to raise a different Stripes ActionBean
event depending on the button being hit (or in the case of enter key I know what event to fire a priori).
I can apply a custom CSS class to all fields (booooooooooooring) and I can select all form fields in a page with $$('input[type!=button], select')
.
How to constrain the selection to elements that descend from a given form
tags (which has an ID?). The selection will be used to handle the keyup
event
$$('input[type!=button],select', '#formid')
*
selects all elements.