Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Jquery Wordpress Taxonomy

Posted on 2014-04-25
3
Medium Priority
?
412 Views
Last Modified: 2014-04-25
Hi guys,

I have  a worpress taxonomy which has a list of terms

For example

>Shop
>>Fashion
>>Sports
>>etc

>Service
>>Accountant
>>Solicitor
>>etc


I wish to make a drop down menu (<select>)

Which lists all the parent terms ie >Service,

I also wish to have a second drop down which is disabled by default, which is only active when the parent select is selected and has a valid value,

So for example

Primary Select :Service

Secondary select

>>Accountant
>>Solicitor
>>etc


Thanks for the help in advanced

This does not need to be Ajax just a simple Javascript 2-d array I think

J
0
Comment
Question by:john_yourspace
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 59

Accepted Solution

by:
Julian Hansen earned 2000 total points
ID: 40022618
Something like this
<!doctype html>
<html>
<head>
<title>Test</title>
<script src="http://code.jquery.com/jquery.js"></script>
<script type="text/javascript">
var terms = {
  One : ['Item1','Item2','Item3'],
  Two: ['Item4','Item5','Item6']
};

$(function() {
  $('#parent').change(function() {
    var key = $(this).val();
    $('#child').empty();
    if (typeof terms[key] != undefined) {
      $(terms[key]).each(function(i,a) {
        $('#child').append($('<option/>').attr('value', a).html(a));
      });
    }
  });
});

</script>
<style type="text/css">
</style>
</head>
<body>
  <select id="parent">
    <option value="">Select One</option>
    <option value="One">One</option>
    <option value="Two">Two</option>
  </select>
  <select id="child">
  </select>
</body>
</html>

Open in new window

Working sample here http://www.marcorpsa.com/ee/t651.html
0
 

Author Closing Comment

by:john_yourspace
ID: 40022670
That worked perfect thanks for the help
0
 
LVL 59

Expert Comment

by:Julian Hansen
ID: 40022695
You are welcome - thanks for the points.
0

Featured Post

Interactive Way of Training for the AWS CSA Exam

An interactive way of learning that will help you visualize core concepts so that you can be more effective when taking your AWS certification exam.  Built for students by a student to help them understand the concepts that they are being taught.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question