Closed. This question is off-topic. It is not currently accepting answers.admin管理员组文章数量:1415145
Your question should be specific to WordPress. Generic PHP/JS/HTML/CSS questions might be better asked at Stack Overflow or another appropriate site of the Stack Exchange network. Third party plugins and themes are off topic.
Closed 10 years ago.
Improve this questionI am using contact-form-7 plugin for one of my form in the site. In that I have some dropdown options. The option are mainly consists of some come courses with their names. Like course 1, course 2, course 3, course 4....so on
. But I want that my course field should be seen like this
Course A:
course 1
course 2
course 3
course 4
Course B:
course 1
course 2
course 3
Course C:
course 1
course 2
Course D:
course 1
course 2
course 3
Currently I have done this type of fields in my contact-form-7 plugin
Course applied for[select courser-applied class:course-applied "Course A" "course 1" "course 2" "course 3" "course 4" "Course B:" "course 1" "course 2" "course 3" "Course C:" "course 1" "course 2" "Course D:" "course 1" "course 2" "course3"]
But this one is not working as I want that course A,course B, course C, course D should come in strong character in dropdowns . So can someone kindly tell me how to do this?
Here how I want my form dropdown should look like
Your question should be specific to WordPress. Generic PHP/JS/HTML/CSS questions might be better asked at Stack Overflow or another appropriate site of the Stack Exchange network. Third party plugins and themes are off topic.
Closed 10 years ago.
Improve this questionI am using contact-form-7 plugin for one of my form in the site. In that I have some dropdown options. The option are mainly consists of some come courses with their names. Like course 1, course 2, course 3, course 4....so on
. But I want that my course field should be seen like this
Course A:
course 1
course 2
course 3
course 4
Course B:
course 1
course 2
course 3
Course C:
course 1
course 2
Course D:
course 1
course 2
course 3
Currently I have done this type of fields in my contact-form-7 plugin
Course applied for[select courser-applied class:course-applied "Course A" "course 1" "course 2" "course 3" "course 4" "Course B:" "course 1" "course 2" "course 3" "Course C:" "course 1" "course 2" "Course D:" "course 1" "course 2" "course3"]
But this one is not working as I want that course A,course B, course C, course D should come in strong character in dropdowns . So can someone kindly tell me how to do this?
Here how I want my form dropdown should look like
1 Answer
Reset to default 2-- Append parent_ to all your top level options' values like: parent_Course A, parent_Course B -- Also add extra options with the value as "endparent" something like below structure
parent_Course A:
course 1
course 2
course 3
course 4
endparent
parent_Course B:
course 1
course 2
course 3
endparent
Code:
// contact us form - change out optgroup labels
$(function() {
// search for parent_ items
var foundin = $('option:contains("parent_")');
$.each(foundin, function(value) {
var updated = $(this).val().replace("parent_","");
// find all following elements until endparent
$(this).nextUntil('option:contains("endparent")')
.wrapAll('<optgroup label="'+ updated +'"></optgroup');
});
// remove placeholder options
$('option:contains("parent_")').remove();
$('option:contains("endparent")').remove();
});
本文标签: pluginsWordpress contact form 7 to show the form dropdown menus as like
版权声明:本文标题:plugins - Wordpress contact form 7 to show the form dropdown menus as like 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745213381a2648019.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论