Clear 2nd Dropdown values based on 1st Dropdown valueWhat are valid values for the id attribute in HTML?Which “href” value should I use for JavaScript links, “#” or “javascript:void(0)”?Set a default parameter value for a JavaScript functionHow can I get query string values in JavaScript?Get selected value in dropdown list using JavaScriptSort array of objects by string property valueHow to style a <select> dropdown with only CSS?Copy array by valuejQuery Get Selected Option From DropdownHow to - Make 1st dynamic dropdown MUST to select from 2nd dropdown?
How can glass marbles naturally occur in a desert?
What are good ways to improve as a writer other than writing courses?
Is it allowed and safe to carry a passenger / non-pilot in the front seat of a small general aviation airplane?
What are the examples (applications) of the MIPs in which the objective function has nonzero coefficients for only continuous variables?
Can I enter a rental property without giving notice if I'm afraid a tenant may be hurt?
Japanese equivalent of a brain fart
Finish the Mastermind
What does VB stand for?
HttpResponse[Status=BAD_REQUEST, StatusCode=400]
How does The Fools Guild make its money?
What are these mathematical groups in U.S. universities?
Our group keeps dying during the Lost Mine of Phandelver campaign. What are we doing wrong?
WordCloud: do not eliminate duplicates
In the movie Harry Potter and the Order or the Phoenix, why didn't Mr. Filch succeed to open the Room of Requirement if it's what he needed?
How to explain to a team that the project they will work for 6 months will 100% fail?
Why are the inside diameters of some pipe larger than the stated size?
Does this put me at risk for identity theft?
Colleagues speaking another language and it impacts work
Can a character take on additional backgrounds, or at least their benefits?
Is it true that control+alt+delete only became a thing because IBM would not build Bill Gates a computer with a task manager button?
How is the return type of a ternary operator determined?
Why does putting a dot after the URL remove login information?
Why can I log in to my Facebook account with a misspelled email/password?
Did silent film actors actually say their lines or did they simply improvise “dialogue” while being filmed?
Clear 2nd Dropdown values based on 1st Dropdown value
What are valid values for the id attribute in HTML?Which “href” value should I use for JavaScript links, “#” or “javascript:void(0)”?Set a default parameter value for a JavaScript functionHow can I get query string values in JavaScript?Get selected value in dropdown list using JavaScriptSort array of objects by string property valueHow to style a <select> dropdown with only CSS?Copy array by valuejQuery Get Selected Option From DropdownHow to - Make 1st dynamic dropdown MUST to select from 2nd dropdown?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
When I select 1st Dropdown, I need to clear 2nd Dropdown.
I had used .empty()
method but if I use this method later on I am not getting 2nd dropdown values.
I've tried the following method:
$("#taskcategorylist").change(function ()
console.log("Task Category Changed");
$('#tasktypes').val("");
);
1st dropdown Html code:
<div class="field">
<b>Task Category</b>
<div class="ui selection dropdown">
<i class="dropdown icon"></i>
<div class="default text">Select</div>
<div class="menu" id="taskcategorylist"></div>
</div>
</div>
2nd dropdown Html code:
<div class="field">
<b>Task Type</b>
<div class="ui selection dropdown">
<i class="dropdown icon"></i>
<div class="default text">Select</div>
<div class="menu" id="tasktypes"></div>
</div>
</div>
1st dropdown Jquery code:
$.get(window.routemap + "api/task/taskcategory", function (data)
self.taskcategorylist = JSON.parse(data.Data).Lookup;
self.taskcategorylist.forEach(function (item)
$('#taskcategorylist').append("<div class='item' data-value='" +
item.category_id + "'> " + item.category_name + "</div >");
);
);
2nd dropdown Jquery code:
$.get(window.routemap + "api/firm/tasktypes", function (data)
self.tasktypes = JSON.parse(data.Data).Lookup;
self.tasktypes.forEach(function (data)
$('#tasktypes').append("<div class='item' data-value='" +
data.tasktype_id + "'> " + data.task_name + "</div >");
);
);
javascript jquery html css semantic-ui
add a comment |
When I select 1st Dropdown, I need to clear 2nd Dropdown.
I had used .empty()
method but if I use this method later on I am not getting 2nd dropdown values.
I've tried the following method:
$("#taskcategorylist").change(function ()
console.log("Task Category Changed");
$('#tasktypes').val("");
);
1st dropdown Html code:
<div class="field">
<b>Task Category</b>
<div class="ui selection dropdown">
<i class="dropdown icon"></i>
<div class="default text">Select</div>
<div class="menu" id="taskcategorylist"></div>
</div>
</div>
2nd dropdown Html code:
<div class="field">
<b>Task Type</b>
<div class="ui selection dropdown">
<i class="dropdown icon"></i>
<div class="default text">Select</div>
<div class="menu" id="tasktypes"></div>
</div>
</div>
1st dropdown Jquery code:
$.get(window.routemap + "api/task/taskcategory", function (data)
self.taskcategorylist = JSON.parse(data.Data).Lookup;
self.taskcategorylist.forEach(function (item)
$('#taskcategorylist').append("<div class='item' data-value='" +
item.category_id + "'> " + item.category_name + "</div >");
);
);
2nd dropdown Jquery code:
$.get(window.routemap + "api/firm/tasktypes", function (data)
self.tasktypes = JSON.parse(data.Data).Lookup;
self.tasktypes.forEach(function (data)
$('#tasktypes').append("<div class='item' data-value='" +
data.tasktype_id + "'> " + data.task_name + "</div >");
);
);
javascript jquery html css semantic-ui
add a comment |
When I select 1st Dropdown, I need to clear 2nd Dropdown.
I had used .empty()
method but if I use this method later on I am not getting 2nd dropdown values.
I've tried the following method:
$("#taskcategorylist").change(function ()
console.log("Task Category Changed");
$('#tasktypes').val("");
);
1st dropdown Html code:
<div class="field">
<b>Task Category</b>
<div class="ui selection dropdown">
<i class="dropdown icon"></i>
<div class="default text">Select</div>
<div class="menu" id="taskcategorylist"></div>
</div>
</div>
2nd dropdown Html code:
<div class="field">
<b>Task Type</b>
<div class="ui selection dropdown">
<i class="dropdown icon"></i>
<div class="default text">Select</div>
<div class="menu" id="tasktypes"></div>
</div>
</div>
1st dropdown Jquery code:
$.get(window.routemap + "api/task/taskcategory", function (data)
self.taskcategorylist = JSON.parse(data.Data).Lookup;
self.taskcategorylist.forEach(function (item)
$('#taskcategorylist').append("<div class='item' data-value='" +
item.category_id + "'> " + item.category_name + "</div >");
);
);
2nd dropdown Jquery code:
$.get(window.routemap + "api/firm/tasktypes", function (data)
self.tasktypes = JSON.parse(data.Data).Lookup;
self.tasktypes.forEach(function (data)
$('#tasktypes').append("<div class='item' data-value='" +
data.tasktype_id + "'> " + data.task_name + "</div >");
);
);
javascript jquery html css semantic-ui
When I select 1st Dropdown, I need to clear 2nd Dropdown.
I had used .empty()
method but if I use this method later on I am not getting 2nd dropdown values.
I've tried the following method:
$("#taskcategorylist").change(function ()
console.log("Task Category Changed");
$('#tasktypes').val("");
);
1st dropdown Html code:
<div class="field">
<b>Task Category</b>
<div class="ui selection dropdown">
<i class="dropdown icon"></i>
<div class="default text">Select</div>
<div class="menu" id="taskcategorylist"></div>
</div>
</div>
2nd dropdown Html code:
<div class="field">
<b>Task Type</b>
<div class="ui selection dropdown">
<i class="dropdown icon"></i>
<div class="default text">Select</div>
<div class="menu" id="tasktypes"></div>
</div>
</div>
1st dropdown Jquery code:
$.get(window.routemap + "api/task/taskcategory", function (data)
self.taskcategorylist = JSON.parse(data.Data).Lookup;
self.taskcategorylist.forEach(function (item)
$('#taskcategorylist').append("<div class='item' data-value='" +
item.category_id + "'> " + item.category_name + "</div >");
);
);
2nd dropdown Jquery code:
$.get(window.routemap + "api/firm/tasktypes", function (data)
self.tasktypes = JSON.parse(data.Data).Lookup;
self.tasktypes.forEach(function (data)
$('#tasktypes').append("<div class='item' data-value='" +
data.tasktype_id + "'> " + data.task_name + "</div >");
);
);
javascript jquery html css semantic-ui
javascript jquery html css semantic-ui
edited Mar 27 at 7:54
piet.t
10.2k7 gold badges36 silver badges48 bronze badges
10.2k7 gold badges36 silver badges48 bronze badges
asked Mar 27 at 6:06
Yathish kumarYathish kumar
405 bronze badges
405 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Try this code.
$("#taskcategorylist").change(function ()
console.log("Task Category Changed");
$('#tasktypes').parents(".ui.dropdown").dropdown('clear');
);
no luck its not working.
– Yathish kumar
Mar 27 at 6:37
What's not working? I'm using the same framework, and I'm using same kind of approach that you are using, this code is working for me, can you show us working demo or snippet, so It would be easy to debug the problem
– Abhishek Pandey
Mar 27 at 6:41
1
Yes its works now i made mistake in the events, your answer exactly works for me has expected, Thank you.
– Yathish kumar
Mar 27 at 6:58
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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%2f55370785%2fclear-2nd-dropdown-values-based-on-1st-dropdown-value%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this code.
$("#taskcategorylist").change(function ()
console.log("Task Category Changed");
$('#tasktypes').parents(".ui.dropdown").dropdown('clear');
);
no luck its not working.
– Yathish kumar
Mar 27 at 6:37
What's not working? I'm using the same framework, and I'm using same kind of approach that you are using, this code is working for me, can you show us working demo or snippet, so It would be easy to debug the problem
– Abhishek Pandey
Mar 27 at 6:41
1
Yes its works now i made mistake in the events, your answer exactly works for me has expected, Thank you.
– Yathish kumar
Mar 27 at 6:58
add a comment |
Try this code.
$("#taskcategorylist").change(function ()
console.log("Task Category Changed");
$('#tasktypes').parents(".ui.dropdown").dropdown('clear');
);
no luck its not working.
– Yathish kumar
Mar 27 at 6:37
What's not working? I'm using the same framework, and I'm using same kind of approach that you are using, this code is working for me, can you show us working demo or snippet, so It would be easy to debug the problem
– Abhishek Pandey
Mar 27 at 6:41
1
Yes its works now i made mistake in the events, your answer exactly works for me has expected, Thank you.
– Yathish kumar
Mar 27 at 6:58
add a comment |
Try this code.
$("#taskcategorylist").change(function ()
console.log("Task Category Changed");
$('#tasktypes').parents(".ui.dropdown").dropdown('clear');
);
Try this code.
$("#taskcategorylist").change(function ()
console.log("Task Category Changed");
$('#tasktypes').parents(".ui.dropdown").dropdown('clear');
);
answered Mar 27 at 6:22
Abhishek PandeyAbhishek Pandey
10.4k8 gold badges23 silver badges51 bronze badges
10.4k8 gold badges23 silver badges51 bronze badges
no luck its not working.
– Yathish kumar
Mar 27 at 6:37
What's not working? I'm using the same framework, and I'm using same kind of approach that you are using, this code is working for me, can you show us working demo or snippet, so It would be easy to debug the problem
– Abhishek Pandey
Mar 27 at 6:41
1
Yes its works now i made mistake in the events, your answer exactly works for me has expected, Thank you.
– Yathish kumar
Mar 27 at 6:58
add a comment |
no luck its not working.
– Yathish kumar
Mar 27 at 6:37
What's not working? I'm using the same framework, and I'm using same kind of approach that you are using, this code is working for me, can you show us working demo or snippet, so It would be easy to debug the problem
– Abhishek Pandey
Mar 27 at 6:41
1
Yes its works now i made mistake in the events, your answer exactly works for me has expected, Thank you.
– Yathish kumar
Mar 27 at 6:58
no luck its not working.
– Yathish kumar
Mar 27 at 6:37
no luck its not working.
– Yathish kumar
Mar 27 at 6:37
What's not working? I'm using the same framework, and I'm using same kind of approach that you are using, this code is working for me, can you show us working demo or snippet, so It would be easy to debug the problem
– Abhishek Pandey
Mar 27 at 6:41
What's not working? I'm using the same framework, and I'm using same kind of approach that you are using, this code is working for me, can you show us working demo or snippet, so It would be easy to debug the problem
– Abhishek Pandey
Mar 27 at 6:41
1
1
Yes its works now i made mistake in the events, your answer exactly works for me has expected, Thank you.
– Yathish kumar
Mar 27 at 6:58
Yes its works now i made mistake in the events, your answer exactly works for me has expected, Thank you.
– Yathish kumar
Mar 27 at 6:58
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
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.
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%2f55370785%2fclear-2nd-dropdown-values-based-on-1st-dropdown-value%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