how to create a drill down search menu on a website
up vote
-2
down vote
favorite
I am trying to set up a website (i have used a bootstrap template and made some changes to it). I want a search function on top of the page where you can select a product but then there will be another drop down.
For example one search box, which is a drop down menu will have a list of vehicles; audi bmw and Mercedes. if you select Audi i want the drop down next to it to only show model that belong to the audi range and so on.
Also for forward planning; if a new model vehicle releases for audi how would i then add this to my list?
----------------UPDATE---------------
I managed to do some research and got the code working kind of.
I have incorporated JS in my website. I've got the first drop down to work but the second drop down does not run?
$('.dropdown')function configureDropDownLists(ddl1,ddl2) {
var Audi = new Array('A1', 'S1', 'RS3');
var BMW = new Array('3 series', '5 series', 'M5');
var Ford = new Array('A Class', 'C Class', 'E class');
switch (ddl1.value) {
case 'Audi':
ddl2.options.length = 0;
for (i = 0; i < Audi.length; i++) {
createOption(ddl2, Audi[i], Audi[i]);
}
break;
case 'BMW':
ddl2.options.length = 0;
for (i = 0; i < BMW.length; i++) {
createOption(ddl2, BMW[i], BMW[i]);
}
break;
case 'Ford':
ddl2.options.length = 0;
for (i = 0; i < Ford.length; i++) {
createOption(ddl2, Ford[i], Ford[i]);
}
break;
default:
ddl2.options.length = 0;
break;
}
}
$('.dropdown2')function createOption(ddl, text, value) {
var opt = document.createElement('option');
opt.value = value;
opt.text = text;
ddl.options.add(opt);
} <select class="dropdown" id="ddl" onchange="configureDropDownLists(this,document.getElementById('ddl2'))">
<option value=""></option>
<option value="Audi">Audi</option>
<option value="BMW">BMW</option>
<option value="Ford">Ford</option>
</select>
<select id="ddl2">
</select>jquery html css
add a comment |
up vote
-2
down vote
favorite
I am trying to set up a website (i have used a bootstrap template and made some changes to it). I want a search function on top of the page where you can select a product but then there will be another drop down.
For example one search box, which is a drop down menu will have a list of vehicles; audi bmw and Mercedes. if you select Audi i want the drop down next to it to only show model that belong to the audi range and so on.
Also for forward planning; if a new model vehicle releases for audi how would i then add this to my list?
----------------UPDATE---------------
I managed to do some research and got the code working kind of.
I have incorporated JS in my website. I've got the first drop down to work but the second drop down does not run?
$('.dropdown')function configureDropDownLists(ddl1,ddl2) {
var Audi = new Array('A1', 'S1', 'RS3');
var BMW = new Array('3 series', '5 series', 'M5');
var Ford = new Array('A Class', 'C Class', 'E class');
switch (ddl1.value) {
case 'Audi':
ddl2.options.length = 0;
for (i = 0; i < Audi.length; i++) {
createOption(ddl2, Audi[i], Audi[i]);
}
break;
case 'BMW':
ddl2.options.length = 0;
for (i = 0; i < BMW.length; i++) {
createOption(ddl2, BMW[i], BMW[i]);
}
break;
case 'Ford':
ddl2.options.length = 0;
for (i = 0; i < Ford.length; i++) {
createOption(ddl2, Ford[i], Ford[i]);
}
break;
default:
ddl2.options.length = 0;
break;
}
}
$('.dropdown2')function createOption(ddl, text, value) {
var opt = document.createElement('option');
opt.value = value;
opt.text = text;
ddl.options.add(opt);
} <select class="dropdown" id="ddl" onchange="configureDropDownLists(this,document.getElementById('ddl2'))">
<option value=""></option>
<option value="Audi">Audi</option>
<option value="BMW">BMW</option>
<option value="Ford">Ford</option>
</select>
<select id="ddl2">
</select>jquery html css
what you are communicating about is not dropdown menu. it is more or less like a tree view. like in windows explorer. except that you are not asking for a trailing line from the root.
– vssadineni
Nov 21 at 13:37
And this is not the right place for ideating. Instead work on it and if you have some code and got stuck anyone from 'SO' can help you with it.
– vssadineni
Nov 21 at 13:44
@HaseebMohammed. Would a dropdown that opened another dropdown be useful, like this: w3schools.com/bootstrap/…
– user2796515
Nov 21 at 14:05
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
I am trying to set up a website (i have used a bootstrap template and made some changes to it). I want a search function on top of the page where you can select a product but then there will be another drop down.
For example one search box, which is a drop down menu will have a list of vehicles; audi bmw and Mercedes. if you select Audi i want the drop down next to it to only show model that belong to the audi range and so on.
Also for forward planning; if a new model vehicle releases for audi how would i then add this to my list?
----------------UPDATE---------------
I managed to do some research and got the code working kind of.
I have incorporated JS in my website. I've got the first drop down to work but the second drop down does not run?
$('.dropdown')function configureDropDownLists(ddl1,ddl2) {
var Audi = new Array('A1', 'S1', 'RS3');
var BMW = new Array('3 series', '5 series', 'M5');
var Ford = new Array('A Class', 'C Class', 'E class');
switch (ddl1.value) {
case 'Audi':
ddl2.options.length = 0;
for (i = 0; i < Audi.length; i++) {
createOption(ddl2, Audi[i], Audi[i]);
}
break;
case 'BMW':
ddl2.options.length = 0;
for (i = 0; i < BMW.length; i++) {
createOption(ddl2, BMW[i], BMW[i]);
}
break;
case 'Ford':
ddl2.options.length = 0;
for (i = 0; i < Ford.length; i++) {
createOption(ddl2, Ford[i], Ford[i]);
}
break;
default:
ddl2.options.length = 0;
break;
}
}
$('.dropdown2')function createOption(ddl, text, value) {
var opt = document.createElement('option');
opt.value = value;
opt.text = text;
ddl.options.add(opt);
} <select class="dropdown" id="ddl" onchange="configureDropDownLists(this,document.getElementById('ddl2'))">
<option value=""></option>
<option value="Audi">Audi</option>
<option value="BMW">BMW</option>
<option value="Ford">Ford</option>
</select>
<select id="ddl2">
</select>jquery html css
I am trying to set up a website (i have used a bootstrap template and made some changes to it). I want a search function on top of the page where you can select a product but then there will be another drop down.
For example one search box, which is a drop down menu will have a list of vehicles; audi bmw and Mercedes. if you select Audi i want the drop down next to it to only show model that belong to the audi range and so on.
Also for forward planning; if a new model vehicle releases for audi how would i then add this to my list?
----------------UPDATE---------------
I managed to do some research and got the code working kind of.
I have incorporated JS in my website. I've got the first drop down to work but the second drop down does not run?
$('.dropdown')function configureDropDownLists(ddl1,ddl2) {
var Audi = new Array('A1', 'S1', 'RS3');
var BMW = new Array('3 series', '5 series', 'M5');
var Ford = new Array('A Class', 'C Class', 'E class');
switch (ddl1.value) {
case 'Audi':
ddl2.options.length = 0;
for (i = 0; i < Audi.length; i++) {
createOption(ddl2, Audi[i], Audi[i]);
}
break;
case 'BMW':
ddl2.options.length = 0;
for (i = 0; i < BMW.length; i++) {
createOption(ddl2, BMW[i], BMW[i]);
}
break;
case 'Ford':
ddl2.options.length = 0;
for (i = 0; i < Ford.length; i++) {
createOption(ddl2, Ford[i], Ford[i]);
}
break;
default:
ddl2.options.length = 0;
break;
}
}
$('.dropdown2')function createOption(ddl, text, value) {
var opt = document.createElement('option');
opt.value = value;
opt.text = text;
ddl.options.add(opt);
} <select class="dropdown" id="ddl" onchange="configureDropDownLists(this,document.getElementById('ddl2'))">
<option value=""></option>
<option value="Audi">Audi</option>
<option value="BMW">BMW</option>
<option value="Ford">Ford</option>
</select>
<select id="ddl2">
</select> $('.dropdown')function configureDropDownLists(ddl1,ddl2) {
var Audi = new Array('A1', 'S1', 'RS3');
var BMW = new Array('3 series', '5 series', 'M5');
var Ford = new Array('A Class', 'C Class', 'E class');
switch (ddl1.value) {
case 'Audi':
ddl2.options.length = 0;
for (i = 0; i < Audi.length; i++) {
createOption(ddl2, Audi[i], Audi[i]);
}
break;
case 'BMW':
ddl2.options.length = 0;
for (i = 0; i < BMW.length; i++) {
createOption(ddl2, BMW[i], BMW[i]);
}
break;
case 'Ford':
ddl2.options.length = 0;
for (i = 0; i < Ford.length; i++) {
createOption(ddl2, Ford[i], Ford[i]);
}
break;
default:
ddl2.options.length = 0;
break;
}
}
$('.dropdown2')function createOption(ddl, text, value) {
var opt = document.createElement('option');
opt.value = value;
opt.text = text;
ddl.options.add(opt);
} <select class="dropdown" id="ddl" onchange="configureDropDownLists(this,document.getElementById('ddl2'))">
<option value=""></option>
<option value="Audi">Audi</option>
<option value="BMW">BMW</option>
<option value="Ford">Ford</option>
</select>
<select id="ddl2">
</select> $('.dropdown')function configureDropDownLists(ddl1,ddl2) {
var Audi = new Array('A1', 'S1', 'RS3');
var BMW = new Array('3 series', '5 series', 'M5');
var Ford = new Array('A Class', 'C Class', 'E class');
switch (ddl1.value) {
case 'Audi':
ddl2.options.length = 0;
for (i = 0; i < Audi.length; i++) {
createOption(ddl2, Audi[i], Audi[i]);
}
break;
case 'BMW':
ddl2.options.length = 0;
for (i = 0; i < BMW.length; i++) {
createOption(ddl2, BMW[i], BMW[i]);
}
break;
case 'Ford':
ddl2.options.length = 0;
for (i = 0; i < Ford.length; i++) {
createOption(ddl2, Ford[i], Ford[i]);
}
break;
default:
ddl2.options.length = 0;
break;
}
}
$('.dropdown2')function createOption(ddl, text, value) {
var opt = document.createElement('option');
opt.value = value;
opt.text = text;
ddl.options.add(opt);
} <select class="dropdown" id="ddl" onchange="configureDropDownLists(this,document.getElementById('ddl2'))">
<option value=""></option>
<option value="Audi">Audi</option>
<option value="BMW">BMW</option>
<option value="Ford">Ford</option>
</select>
<select id="ddl2">
</select>jquery html css
jquery html css
edited Nov 22 at 18:56
j08691
164k20189212
164k20189212
asked Nov 21 at 13:12
Haseeb Mohammed
61
61
what you are communicating about is not dropdown menu. it is more or less like a tree view. like in windows explorer. except that you are not asking for a trailing line from the root.
– vssadineni
Nov 21 at 13:37
And this is not the right place for ideating. Instead work on it and if you have some code and got stuck anyone from 'SO' can help you with it.
– vssadineni
Nov 21 at 13:44
@HaseebMohammed. Would a dropdown that opened another dropdown be useful, like this: w3schools.com/bootstrap/…
– user2796515
Nov 21 at 14:05
add a comment |
what you are communicating about is not dropdown menu. it is more or less like a tree view. like in windows explorer. except that you are not asking for a trailing line from the root.
– vssadineni
Nov 21 at 13:37
And this is not the right place for ideating. Instead work on it and if you have some code and got stuck anyone from 'SO' can help you with it.
– vssadineni
Nov 21 at 13:44
@HaseebMohammed. Would a dropdown that opened another dropdown be useful, like this: w3schools.com/bootstrap/…
– user2796515
Nov 21 at 14:05
what you are communicating about is not dropdown menu. it is more or less like a tree view. like in windows explorer. except that you are not asking for a trailing line from the root.
– vssadineni
Nov 21 at 13:37
what you are communicating about is not dropdown menu. it is more or less like a tree view. like in windows explorer. except that you are not asking for a trailing line from the root.
– vssadineni
Nov 21 at 13:37
And this is not the right place for ideating. Instead work on it and if you have some code and got stuck anyone from 'SO' can help you with it.
– vssadineni
Nov 21 at 13:44
And this is not the right place for ideating. Instead work on it and if you have some code and got stuck anyone from 'SO' can help you with it.
– vssadineni
Nov 21 at 13:44
@HaseebMohammed. Would a dropdown that opened another dropdown be useful, like this: w3schools.com/bootstrap/…
– user2796515
Nov 21 at 14:05
@HaseebMohammed. Would a dropdown that opened another dropdown be useful, like this: w3schools.com/bootstrap/…
– user2796515
Nov 21 at 14:05
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412837%2fhow-to-create-a-drill-down-search-menu-on-a-website%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
what you are communicating about is not dropdown menu. it is more or less like a tree view. like in windows explorer. except that you are not asking for a trailing line from the root.
– vssadineni
Nov 21 at 13:37
And this is not the right place for ideating. Instead work on it and if you have some code and got stuck anyone from 'SO' can help you with it.
– vssadineni
Nov 21 at 13:44
@HaseebMohammed. Would a dropdown that opened another dropdown be useful, like this: w3schools.com/bootstrap/…
– user2796515
Nov 21 at 14:05