How can I add an id to the search field in this example?
[wpv-control taxonomy="attorney-practice-area" id="wpv_control_select_practice_area" url_param="wpv-attorney-practice-area" type="select" default_label="BY PRACTICE" taxonomy_order="ASC" taxonomy_orderby="name" hide_empty="false"]
Hello,
There isn't such an exact feature within Views shortcode [wpv-control], no "id" attribute.
If you are going to apply custom CSS codes or JS codes to it, you can try with attribute selector, for example:
select[name="wpv-attorney-practice-area"]{
// here add your CSS codes
}
More help:
hidden link
thanks Lou but I need the id to so that I can specify a label to the field in order to make the form ADA Compliant.
As I mentioned above, no "id" attribute in the shortcode [wpv-control], see our document:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-control
If you agree, we can take it as a feature request.
You might consider to use custom JS codes to add the ID attribute, for example:
jQuery(document).ready(function ($){
$('select[name="wpv-attorney-practice-area"]').attr('id', 'wpv_control_select_practice_area');
})
Ok Thanks. Lou. I may try that in the future. For now, I found a workaround by wrapping the label tag around the field.
Thanks
Sorry Lou, one more question.
Is it possible to add the id to this:
[wpv-filter-search-box class="text-search"]
Thanks
The shortcode [wpv-filter-search-box] does not support id attribute too, see our document:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-filter-search-box
You might try the same workaround as you mentioned above:
wrapping the label tag around the field.
Thank Luo. The wrap around idea did not work for text field but your JS solution did work to add the id to the field.
Thanks Again!