How can I change select options with javascript?
up vote
-1
down vote
favorite
I have a select with options I need when I select an option another two disappear in the same select
<select class="select cf-select" name="customfield_10303" id="customfield_10303">
<option value="">None</option>
<option value="10200">Opened</option>
<option value="10201">Closed</option>
<option value="10202">Escalated</option>
<option value="10203">Handled</option>
<option value="10204">Deferred</option>
<option value="10205">Reopened</option>
<option value="10206">Could Not Be Resolved</option>
</select>
this is the HTML code I need javascript code when I select opened Just Escalated and Deferred are only appear
javascript html select jira
add a comment |
up vote
-1
down vote
favorite
I have a select with options I need when I select an option another two disappear in the same select
<select class="select cf-select" name="customfield_10303" id="customfield_10303">
<option value="">None</option>
<option value="10200">Opened</option>
<option value="10201">Closed</option>
<option value="10202">Escalated</option>
<option value="10203">Handled</option>
<option value="10204">Deferred</option>
<option value="10205">Reopened</option>
<option value="10206">Could Not Be Resolved</option>
</select>
this is the HTML code I need javascript code when I select opened Just Escalated and Deferred are only appear
javascript html select jira
2
You forgot posting the code.
– Foo
Nov 11 at 13:58
All you have posted is a goal, but not any code related problems associated with achieving that goal as outlined in How to Ask and Minimal, Complete, and Verifiable example
– charlietfl
Nov 11 at 14:00
I select Opened Just Escalated and Deferred are only appear
Ok. Why exactly these? According to what scheme?
– Smollet777
Nov 11 at 14:33
I have my own scheme I need to know how the code will look like I need this to add in Jira custom field issues
– m.nabil
Nov 11 at 14:39
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I have a select with options I need when I select an option another two disappear in the same select
<select class="select cf-select" name="customfield_10303" id="customfield_10303">
<option value="">None</option>
<option value="10200">Opened</option>
<option value="10201">Closed</option>
<option value="10202">Escalated</option>
<option value="10203">Handled</option>
<option value="10204">Deferred</option>
<option value="10205">Reopened</option>
<option value="10206">Could Not Be Resolved</option>
</select>
this is the HTML code I need javascript code when I select opened Just Escalated and Deferred are only appear
javascript html select jira
I have a select with options I need when I select an option another two disappear in the same select
<select class="select cf-select" name="customfield_10303" id="customfield_10303">
<option value="">None</option>
<option value="10200">Opened</option>
<option value="10201">Closed</option>
<option value="10202">Escalated</option>
<option value="10203">Handled</option>
<option value="10204">Deferred</option>
<option value="10205">Reopened</option>
<option value="10206">Could Not Be Resolved</option>
</select>
this is the HTML code I need javascript code when I select opened Just Escalated and Deferred are only appear
javascript html select jira
javascript html select jira
edited Nov 11 at 14:27
asked Nov 11 at 13:56
m.nabil
86
86
2
You forgot posting the code.
– Foo
Nov 11 at 13:58
All you have posted is a goal, but not any code related problems associated with achieving that goal as outlined in How to Ask and Minimal, Complete, and Verifiable example
– charlietfl
Nov 11 at 14:00
I select Opened Just Escalated and Deferred are only appear
Ok. Why exactly these? According to what scheme?
– Smollet777
Nov 11 at 14:33
I have my own scheme I need to know how the code will look like I need this to add in Jira custom field issues
– m.nabil
Nov 11 at 14:39
add a comment |
2
You forgot posting the code.
– Foo
Nov 11 at 13:58
All you have posted is a goal, but not any code related problems associated with achieving that goal as outlined in How to Ask and Minimal, Complete, and Verifiable example
– charlietfl
Nov 11 at 14:00
I select Opened Just Escalated and Deferred are only appear
Ok. Why exactly these? According to what scheme?
– Smollet777
Nov 11 at 14:33
I have my own scheme I need to know how the code will look like I need this to add in Jira custom field issues
– m.nabil
Nov 11 at 14:39
2
2
You forgot posting the code.
– Foo
Nov 11 at 13:58
You forgot posting the code.
– Foo
Nov 11 at 13:58
All you have posted is a goal, but not any code related problems associated with achieving that goal as outlined in How to Ask and Minimal, Complete, and Verifiable example
– charlietfl
Nov 11 at 14:00
All you have posted is a goal, but not any code related problems associated with achieving that goal as outlined in How to Ask and Minimal, Complete, and Verifiable example
– charlietfl
Nov 11 at 14:00
I select Opened Just Escalated and Deferred are only appear
Ok. Why exactly these? According to what scheme?– Smollet777
Nov 11 at 14:33
I select Opened Just Escalated and Deferred are only appear
Ok. Why exactly these? According to what scheme?– Smollet777
Nov 11 at 14:33
I have my own scheme I need to know how the code will look like I need this to add in Jira custom field issues
– m.nabil
Nov 11 at 14:39
I have my own scheme I need to know how the code will look like I need this to add in Jira custom field issues
– m.nabil
Nov 11 at 14:39
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
How exactly you need them to disappear
? Here i just delete them from the DOM.
const selector = document.querySelector("select");
selector.addEventListener("click", addActivityItem);
function addActivityItem(event) {
let options = selector.querySelectorAll("option");
for (let i = 0; i < options.length; i++) {
if (options[i].value !== event.target.value) options[i].remove()
}
}
<select>
<option>One</option>
<option>Two</option>
</select>
yes I need something like this but I need to choose which appear and which disappear
– m.nabil
Nov 11 at 14:28
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
How exactly you need them to disappear
? Here i just delete them from the DOM.
const selector = document.querySelector("select");
selector.addEventListener("click", addActivityItem);
function addActivityItem(event) {
let options = selector.querySelectorAll("option");
for (let i = 0; i < options.length; i++) {
if (options[i].value !== event.target.value) options[i].remove()
}
}
<select>
<option>One</option>
<option>Two</option>
</select>
yes I need something like this but I need to choose which appear and which disappear
– m.nabil
Nov 11 at 14:28
add a comment |
up vote
0
down vote
How exactly you need them to disappear
? Here i just delete them from the DOM.
const selector = document.querySelector("select");
selector.addEventListener("click", addActivityItem);
function addActivityItem(event) {
let options = selector.querySelectorAll("option");
for (let i = 0; i < options.length; i++) {
if (options[i].value !== event.target.value) options[i].remove()
}
}
<select>
<option>One</option>
<option>Two</option>
</select>
yes I need something like this but I need to choose which appear and which disappear
– m.nabil
Nov 11 at 14:28
add a comment |
up vote
0
down vote
up vote
0
down vote
How exactly you need them to disappear
? Here i just delete them from the DOM.
const selector = document.querySelector("select");
selector.addEventListener("click", addActivityItem);
function addActivityItem(event) {
let options = selector.querySelectorAll("option");
for (let i = 0; i < options.length; i++) {
if (options[i].value !== event.target.value) options[i].remove()
}
}
<select>
<option>One</option>
<option>Two</option>
</select>
How exactly you need them to disappear
? Here i just delete them from the DOM.
const selector = document.querySelector("select");
selector.addEventListener("click", addActivityItem);
function addActivityItem(event) {
let options = selector.querySelectorAll("option");
for (let i = 0; i < options.length; i++) {
if (options[i].value !== event.target.value) options[i].remove()
}
}
<select>
<option>One</option>
<option>Two</option>
</select>
const selector = document.querySelector("select");
selector.addEventListener("click", addActivityItem);
function addActivityItem(event) {
let options = selector.querySelectorAll("option");
for (let i = 0; i < options.length; i++) {
if (options[i].value !== event.target.value) options[i].remove()
}
}
<select>
<option>One</option>
<option>Two</option>
</select>
const selector = document.querySelector("select");
selector.addEventListener("click", addActivityItem);
function addActivityItem(event) {
let options = selector.querySelectorAll("option");
for (let i = 0; i < options.length; i++) {
if (options[i].value !== event.target.value) options[i].remove()
}
}
<select>
<option>One</option>
<option>Two</option>
</select>
edited Nov 11 at 14:27
answered Nov 11 at 14:19
Smollet777
921815
921815
yes I need something like this but I need to choose which appear and which disappear
– m.nabil
Nov 11 at 14:28
add a comment |
yes I need something like this but I need to choose which appear and which disappear
– m.nabil
Nov 11 at 14:28
yes I need something like this but I need to choose which appear and which disappear
– m.nabil
Nov 11 at 14:28
yes I need something like this but I need to choose which appear and which disappear
– m.nabil
Nov 11 at 14:28
add a comment |
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%2f53249459%2fhow-can-i-change-select-options-with-javascript%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
2
You forgot posting the code.
– Foo
Nov 11 at 13:58
All you have posted is a goal, but not any code related problems associated with achieving that goal as outlined in How to Ask and Minimal, Complete, and Verifiable example
– charlietfl
Nov 11 at 14:00
I select Opened Just Escalated and Deferred are only appear
Ok. Why exactly these? According to what scheme?– Smollet777
Nov 11 at 14:33
I have my own scheme I need to know how the code will look like I need this to add in Jira custom field issues
– m.nabil
Nov 11 at 14:39