0

I have a select box in admin customer address form like this:

<select id="_item13country_id" name="address[13][country_id]" class="required-entry countries required-entry select required-entry select">
 <option value=""> </option>
 <option value="TH" selected="selected">Thailand</option>
</select>

I need to select country field by using prototype to find which element that contains

country_id

How can I do that ?. Many thanks for your help.

2 Answers 2

2

To select element with id "country_id"

$$("[id*=country_id]")
0
2

Use $$('$=country_id') to get the elements that have the id ending with country_id and $$('$=country_id')[0] to get the first of these elements.

or use $$('[id*=country_id]') to select the elements that contain the text country_id in the id attribute.
Again, to select the first element use $$('[id*=country_id]')[0]

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.