Both If - Else is true












0















Edited ( HTML CODE )
I got problem with my if - else statement (my code is not complete yet)



Edited v2:



Sorry i'm so busy today, so i will make clear of my question : I have 3 If statement , "1st and 3rd if" run when something was typed in the box ,
"2nd if" run when text in the box being removed ,



and because we already have "if statement" for blank box (2nd if) so that means we have 2 case might happen : user typed something similar to "countries" array
Ex : A for Albania, V for Vietnam etc...
and another case is user typed something different from any country in "countries" array Ex: Z (no country begin with Z)



SO the problem is why 2 case happen at the same time ( 1st if and 3rd if )



and about the error "Uncaught TypeError: Cannot read property 'parentNode' of null" can i fix it ???



This is my HTML Code




<div class="test">
<form id="myInput">
<input autocomplete="off" type="text" name="myCountry" placeholder="Country">
</form>
<button style="padding-top:100px;" id="DCM">abc</button>
</div>








var countries = ["Albania","VietNam","Thai","Han","Lao"];

countries.map(function(x){ return x.toUpperCase() })

var searchinput = document.querySelector('#myInput input');

searchinput.addEventListener('keyup',function(e){

var searchChar = e.target.value.toUpperCase();
var parent = e.target.parentNode;
var c = document.createElement("div");
var a = document.createElement("div");
a.setAttribute("id", "autocomplete-list");
a.setAttribute("class", "autocomplete-items");
c.appendChild(a);
parent.appendChild(c);

for (var i = 0; i < countries.length; i++) {
if (countries[i].substr(0,searchChar.length).toUpperCase() == searchChar ) {
var b = document.createElement("div");
b.innerHTML = "<strong>" + countries[i].substr(0, searchChar.length) + "</strong>";
b.innerHTML += countries[i].substr(searchChar.length);
a.appendChild(b);
}
if(searchChar.length == 0) {
var y = document.getElementById("autocomplete-list");
y.parentNode.remove();
}
else{
console.log("He");
}
}





This code is about autocomplete , and when i type nothing in the search bar, it will run the "2nd if" , it worked but return error "Uncaught TypeError: Cannot read property 'parentNode' of null"



And 1 more question is in my code , if i type something it run "1st if" or the "3rd if" because in "1st if" it have condition, and "3rd if" is else, but when i type something , it's all run together exept "2nd if"



Sorry for my bad English , i'm not good at writing










share|improve this question




















  • 1





    please share the html code

    – brk
    Nov 14 '18 at 15:32






  • 2





    The second if (with the else) is now completely separate from the first if. You should write else if, so if (condition1){ block1; } else if (condition 2) { block2; } else { block3; }.

    – GolezTrol
    Nov 14 '18 at 15:33






  • 2





    Your question is not clear. If you want only one of the three ifs to happen, you should do if (condition1) { ... } else if (condition2) { ... } else { ... }. You're getting Cannot read property 'parentNode' of null" because your code is not finding an element with an ID of autocomplete-list. Without seeing the HTML, we cannot tell you why this is the case.

    – Tyler Roper
    Nov 14 '18 at 15:34











  • i added my html code , sorry i forhot

    – Duy Đặng
    Nov 15 '18 at 10:22











  • please add an answer to your question

    – Alesandro Giordano
    Nov 15 '18 at 10:33
















0















Edited ( HTML CODE )
I got problem with my if - else statement (my code is not complete yet)



Edited v2:



Sorry i'm so busy today, so i will make clear of my question : I have 3 If statement , "1st and 3rd if" run when something was typed in the box ,
"2nd if" run when text in the box being removed ,



and because we already have "if statement" for blank box (2nd if) so that means we have 2 case might happen : user typed something similar to "countries" array
Ex : A for Albania, V for Vietnam etc...
and another case is user typed something different from any country in "countries" array Ex: Z (no country begin with Z)



SO the problem is why 2 case happen at the same time ( 1st if and 3rd if )



and about the error "Uncaught TypeError: Cannot read property 'parentNode' of null" can i fix it ???



This is my HTML Code




<div class="test">
<form id="myInput">
<input autocomplete="off" type="text" name="myCountry" placeholder="Country">
</form>
<button style="padding-top:100px;" id="DCM">abc</button>
</div>








var countries = ["Albania","VietNam","Thai","Han","Lao"];

countries.map(function(x){ return x.toUpperCase() })

var searchinput = document.querySelector('#myInput input');

searchinput.addEventListener('keyup',function(e){

var searchChar = e.target.value.toUpperCase();
var parent = e.target.parentNode;
var c = document.createElement("div");
var a = document.createElement("div");
a.setAttribute("id", "autocomplete-list");
a.setAttribute("class", "autocomplete-items");
c.appendChild(a);
parent.appendChild(c);

for (var i = 0; i < countries.length; i++) {
if (countries[i].substr(0,searchChar.length).toUpperCase() == searchChar ) {
var b = document.createElement("div");
b.innerHTML = "<strong>" + countries[i].substr(0, searchChar.length) + "</strong>";
b.innerHTML += countries[i].substr(searchChar.length);
a.appendChild(b);
}
if(searchChar.length == 0) {
var y = document.getElementById("autocomplete-list");
y.parentNode.remove();
}
else{
console.log("He");
}
}





This code is about autocomplete , and when i type nothing in the search bar, it will run the "2nd if" , it worked but return error "Uncaught TypeError: Cannot read property 'parentNode' of null"



And 1 more question is in my code , if i type something it run "1st if" or the "3rd if" because in "1st if" it have condition, and "3rd if" is else, but when i type something , it's all run together exept "2nd if"



Sorry for my bad English , i'm not good at writing










share|improve this question




















  • 1





    please share the html code

    – brk
    Nov 14 '18 at 15:32






  • 2





    The second if (with the else) is now completely separate from the first if. You should write else if, so if (condition1){ block1; } else if (condition 2) { block2; } else { block3; }.

    – GolezTrol
    Nov 14 '18 at 15:33






  • 2





    Your question is not clear. If you want only one of the three ifs to happen, you should do if (condition1) { ... } else if (condition2) { ... } else { ... }. You're getting Cannot read property 'parentNode' of null" because your code is not finding an element with an ID of autocomplete-list. Without seeing the HTML, we cannot tell you why this is the case.

    – Tyler Roper
    Nov 14 '18 at 15:34











  • i added my html code , sorry i forhot

    – Duy Đặng
    Nov 15 '18 at 10:22











  • please add an answer to your question

    – Alesandro Giordano
    Nov 15 '18 at 10:33














0












0








0








Edited ( HTML CODE )
I got problem with my if - else statement (my code is not complete yet)



Edited v2:



Sorry i'm so busy today, so i will make clear of my question : I have 3 If statement , "1st and 3rd if" run when something was typed in the box ,
"2nd if" run when text in the box being removed ,



and because we already have "if statement" for blank box (2nd if) so that means we have 2 case might happen : user typed something similar to "countries" array
Ex : A for Albania, V for Vietnam etc...
and another case is user typed something different from any country in "countries" array Ex: Z (no country begin with Z)



SO the problem is why 2 case happen at the same time ( 1st if and 3rd if )



and about the error "Uncaught TypeError: Cannot read property 'parentNode' of null" can i fix it ???



This is my HTML Code




<div class="test">
<form id="myInput">
<input autocomplete="off" type="text" name="myCountry" placeholder="Country">
</form>
<button style="padding-top:100px;" id="DCM">abc</button>
</div>








var countries = ["Albania","VietNam","Thai","Han","Lao"];

countries.map(function(x){ return x.toUpperCase() })

var searchinput = document.querySelector('#myInput input');

searchinput.addEventListener('keyup',function(e){

var searchChar = e.target.value.toUpperCase();
var parent = e.target.parentNode;
var c = document.createElement("div");
var a = document.createElement("div");
a.setAttribute("id", "autocomplete-list");
a.setAttribute("class", "autocomplete-items");
c.appendChild(a);
parent.appendChild(c);

for (var i = 0; i < countries.length; i++) {
if (countries[i].substr(0,searchChar.length).toUpperCase() == searchChar ) {
var b = document.createElement("div");
b.innerHTML = "<strong>" + countries[i].substr(0, searchChar.length) + "</strong>";
b.innerHTML += countries[i].substr(searchChar.length);
a.appendChild(b);
}
if(searchChar.length == 0) {
var y = document.getElementById("autocomplete-list");
y.parentNode.remove();
}
else{
console.log("He");
}
}





This code is about autocomplete , and when i type nothing in the search bar, it will run the "2nd if" , it worked but return error "Uncaught TypeError: Cannot read property 'parentNode' of null"



And 1 more question is in my code , if i type something it run "1st if" or the "3rd if" because in "1st if" it have condition, and "3rd if" is else, but when i type something , it's all run together exept "2nd if"



Sorry for my bad English , i'm not good at writing










share|improve this question
















Edited ( HTML CODE )
I got problem with my if - else statement (my code is not complete yet)



Edited v2:



Sorry i'm so busy today, so i will make clear of my question : I have 3 If statement , "1st and 3rd if" run when something was typed in the box ,
"2nd if" run when text in the box being removed ,



and because we already have "if statement" for blank box (2nd if) so that means we have 2 case might happen : user typed something similar to "countries" array
Ex : A for Albania, V for Vietnam etc...
and another case is user typed something different from any country in "countries" array Ex: Z (no country begin with Z)



SO the problem is why 2 case happen at the same time ( 1st if and 3rd if )



and about the error "Uncaught TypeError: Cannot read property 'parentNode' of null" can i fix it ???



This is my HTML Code




<div class="test">
<form id="myInput">
<input autocomplete="off" type="text" name="myCountry" placeholder="Country">
</form>
<button style="padding-top:100px;" id="DCM">abc</button>
</div>








var countries = ["Albania","VietNam","Thai","Han","Lao"];

countries.map(function(x){ return x.toUpperCase() })

var searchinput = document.querySelector('#myInput input');

searchinput.addEventListener('keyup',function(e){

var searchChar = e.target.value.toUpperCase();
var parent = e.target.parentNode;
var c = document.createElement("div");
var a = document.createElement("div");
a.setAttribute("id", "autocomplete-list");
a.setAttribute("class", "autocomplete-items");
c.appendChild(a);
parent.appendChild(c);

for (var i = 0; i < countries.length; i++) {
if (countries[i].substr(0,searchChar.length).toUpperCase() == searchChar ) {
var b = document.createElement("div");
b.innerHTML = "<strong>" + countries[i].substr(0, searchChar.length) + "</strong>";
b.innerHTML += countries[i].substr(searchChar.length);
a.appendChild(b);
}
if(searchChar.length == 0) {
var y = document.getElementById("autocomplete-list");
y.parentNode.remove();
}
else{
console.log("He");
}
}





This code is about autocomplete , and when i type nothing in the search bar, it will run the "2nd if" , it worked but return error "Uncaught TypeError: Cannot read property 'parentNode' of null"



And 1 more question is in my code , if i type something it run "1st if" or the "3rd if" because in "1st if" it have condition, and "3rd if" is else, but when i type something , it's all run together exept "2nd if"



Sorry for my bad English , i'm not good at writing






<div class="test">
<form id="myInput">
<input autocomplete="off" type="text" name="myCountry" placeholder="Country">
</form>
<button style="padding-top:100px;" id="DCM">abc</button>
</div>





<div class="test">
<form id="myInput">
<input autocomplete="off" type="text" name="myCountry" placeholder="Country">
</form>
<button style="padding-top:100px;" id="DCM">abc</button>
</div>





var countries = ["Albania","VietNam","Thai","Han","Lao"];

countries.map(function(x){ return x.toUpperCase() })

var searchinput = document.querySelector('#myInput input');

searchinput.addEventListener('keyup',function(e){

var searchChar = e.target.value.toUpperCase();
var parent = e.target.parentNode;
var c = document.createElement("div");
var a = document.createElement("div");
a.setAttribute("id", "autocomplete-list");
a.setAttribute("class", "autocomplete-items");
c.appendChild(a);
parent.appendChild(c);

for (var i = 0; i < countries.length; i++) {
if (countries[i].substr(0,searchChar.length).toUpperCase() == searchChar ) {
var b = document.createElement("div");
b.innerHTML = "<strong>" + countries[i].substr(0, searchChar.length) + "</strong>";
b.innerHTML += countries[i].substr(searchChar.length);
a.appendChild(b);
}
if(searchChar.length == 0) {
var y = document.getElementById("autocomplete-list");
y.parentNode.remove();
}
else{
console.log("He");
}
}





var countries = ["Albania","VietNam","Thai","Han","Lao"];

countries.map(function(x){ return x.toUpperCase() })

var searchinput = document.querySelector('#myInput input');

searchinput.addEventListener('keyup',function(e){

var searchChar = e.target.value.toUpperCase();
var parent = e.target.parentNode;
var c = document.createElement("div");
var a = document.createElement("div");
a.setAttribute("id", "autocomplete-list");
a.setAttribute("class", "autocomplete-items");
c.appendChild(a);
parent.appendChild(c);

for (var i = 0; i < countries.length; i++) {
if (countries[i].substr(0,searchChar.length).toUpperCase() == searchChar ) {
var b = document.createElement("div");
b.innerHTML = "<strong>" + countries[i].substr(0, searchChar.length) + "</strong>";
b.innerHTML += countries[i].substr(searchChar.length);
a.appendChild(b);
}
if(searchChar.length == 0) {
var y = document.getElementById("autocomplete-list");
y.parentNode.remove();
}
else{
console.log("He");
}
}






javascript






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 14:24







Duy Đặng

















asked Nov 14 '18 at 15:30









Duy ĐặngDuy Đặng

234




234








  • 1





    please share the html code

    – brk
    Nov 14 '18 at 15:32






  • 2





    The second if (with the else) is now completely separate from the first if. You should write else if, so if (condition1){ block1; } else if (condition 2) { block2; } else { block3; }.

    – GolezTrol
    Nov 14 '18 at 15:33






  • 2





    Your question is not clear. If you want only one of the three ifs to happen, you should do if (condition1) { ... } else if (condition2) { ... } else { ... }. You're getting Cannot read property 'parentNode' of null" because your code is not finding an element with an ID of autocomplete-list. Without seeing the HTML, we cannot tell you why this is the case.

    – Tyler Roper
    Nov 14 '18 at 15:34











  • i added my html code , sorry i forhot

    – Duy Đặng
    Nov 15 '18 at 10:22











  • please add an answer to your question

    – Alesandro Giordano
    Nov 15 '18 at 10:33














  • 1





    please share the html code

    – brk
    Nov 14 '18 at 15:32






  • 2





    The second if (with the else) is now completely separate from the first if. You should write else if, so if (condition1){ block1; } else if (condition 2) { block2; } else { block3; }.

    – GolezTrol
    Nov 14 '18 at 15:33






  • 2





    Your question is not clear. If you want only one of the three ifs to happen, you should do if (condition1) { ... } else if (condition2) { ... } else { ... }. You're getting Cannot read property 'parentNode' of null" because your code is not finding an element with an ID of autocomplete-list. Without seeing the HTML, we cannot tell you why this is the case.

    – Tyler Roper
    Nov 14 '18 at 15:34











  • i added my html code , sorry i forhot

    – Duy Đặng
    Nov 15 '18 at 10:22











  • please add an answer to your question

    – Alesandro Giordano
    Nov 15 '18 at 10:33








1




1





please share the html code

– brk
Nov 14 '18 at 15:32





please share the html code

– brk
Nov 14 '18 at 15:32




2




2





The second if (with the else) is now completely separate from the first if. You should write else if, so if (condition1){ block1; } else if (condition 2) { block2; } else { block3; }.

– GolezTrol
Nov 14 '18 at 15:33





The second if (with the else) is now completely separate from the first if. You should write else if, so if (condition1){ block1; } else if (condition 2) { block2; } else { block3; }.

– GolezTrol
Nov 14 '18 at 15:33




2




2





Your question is not clear. If you want only one of the three ifs to happen, you should do if (condition1) { ... } else if (condition2) { ... } else { ... }. You're getting Cannot read property 'parentNode' of null" because your code is not finding an element with an ID of autocomplete-list. Without seeing the HTML, we cannot tell you why this is the case.

– Tyler Roper
Nov 14 '18 at 15:34





Your question is not clear. If you want only one of the three ifs to happen, you should do if (condition1) { ... } else if (condition2) { ... } else { ... }. You're getting Cannot read property 'parentNode' of null" because your code is not finding an element with an ID of autocomplete-list. Without seeing the HTML, we cannot tell you why this is the case.

– Tyler Roper
Nov 14 '18 at 15:34













i added my html code , sorry i forhot

– Duy Đặng
Nov 15 '18 at 10:22





i added my html code , sorry i forhot

– Duy Đặng
Nov 15 '18 at 10:22













please add an answer to your question

– Alesandro Giordano
Nov 15 '18 at 10:33





please add an answer to your question

– Alesandro Giordano
Nov 15 '18 at 10:33












1 Answer
1






active

oldest

votes


















1














Your question is not clear. If you want only one of the three ifs to happen, you should do if (condition1) { ... } else if (condition2) { ... } else { ... }. You're getting Cannot read property 'parentNode' of null" because your code is not finding an element with an ID of autocomplete-list. Without seeing the HTML, we cannot tell you why this is the case. Tyler Roper






share|improve this answer
























  • i added my question , i'm really sorry for any confuse with my English

    – Duy Đặng
    Nov 15 '18 at 14:26











  • don't worry, this resolved your issue?

    – Alesandro Giordano
    Nov 15 '18 at 14:32











  • i understand the "if -else " issue but do you have any idea to fix the 'parentNode' ? any better way ?

    – Duy Đặng
    Nov 16 '18 at 3:30











  • Please first rate answer if has resolved your issue

    – Alesandro Giordano
    Nov 16 '18 at 6:14











  • Hello, can you help me 1 more question ?? i edited if-else statement with else if but it wont run the "2nd if", i used console.log(searchChar.length) to check if the value is '0' , its true but the second if wont run unless i remove the "else"

    – Duy Đặng
    Nov 16 '18 at 9:11











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53303619%2fboth-if-else-is-true%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









1














Your question is not clear. If you want only one of the three ifs to happen, you should do if (condition1) { ... } else if (condition2) { ... } else { ... }. You're getting Cannot read property 'parentNode' of null" because your code is not finding an element with an ID of autocomplete-list. Without seeing the HTML, we cannot tell you why this is the case. Tyler Roper






share|improve this answer
























  • i added my question , i'm really sorry for any confuse with my English

    – Duy Đặng
    Nov 15 '18 at 14:26











  • don't worry, this resolved your issue?

    – Alesandro Giordano
    Nov 15 '18 at 14:32











  • i understand the "if -else " issue but do you have any idea to fix the 'parentNode' ? any better way ?

    – Duy Đặng
    Nov 16 '18 at 3:30











  • Please first rate answer if has resolved your issue

    – Alesandro Giordano
    Nov 16 '18 at 6:14











  • Hello, can you help me 1 more question ?? i edited if-else statement with else if but it wont run the "2nd if", i used console.log(searchChar.length) to check if the value is '0' , its true but the second if wont run unless i remove the "else"

    – Duy Đặng
    Nov 16 '18 at 9:11
















1














Your question is not clear. If you want only one of the three ifs to happen, you should do if (condition1) { ... } else if (condition2) { ... } else { ... }. You're getting Cannot read property 'parentNode' of null" because your code is not finding an element with an ID of autocomplete-list. Without seeing the HTML, we cannot tell you why this is the case. Tyler Roper






share|improve this answer
























  • i added my question , i'm really sorry for any confuse with my English

    – Duy Đặng
    Nov 15 '18 at 14:26











  • don't worry, this resolved your issue?

    – Alesandro Giordano
    Nov 15 '18 at 14:32











  • i understand the "if -else " issue but do you have any idea to fix the 'parentNode' ? any better way ?

    – Duy Đặng
    Nov 16 '18 at 3:30











  • Please first rate answer if has resolved your issue

    – Alesandro Giordano
    Nov 16 '18 at 6:14











  • Hello, can you help me 1 more question ?? i edited if-else statement with else if but it wont run the "2nd if", i used console.log(searchChar.length) to check if the value is '0' , its true but the second if wont run unless i remove the "else"

    – Duy Đặng
    Nov 16 '18 at 9:11














1












1








1







Your question is not clear. If you want only one of the three ifs to happen, you should do if (condition1) { ... } else if (condition2) { ... } else { ... }. You're getting Cannot read property 'parentNode' of null" because your code is not finding an element with an ID of autocomplete-list. Without seeing the HTML, we cannot tell you why this is the case. Tyler Roper






share|improve this answer













Your question is not clear. If you want only one of the three ifs to happen, you should do if (condition1) { ... } else if (condition2) { ... } else { ... }. You're getting Cannot read property 'parentNode' of null" because your code is not finding an element with an ID of autocomplete-list. Without seeing the HTML, we cannot tell you why this is the case. Tyler Roper







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 15 '18 at 10:34









Alesandro GiordanoAlesandro Giordano

318110




318110













  • i added my question , i'm really sorry for any confuse with my English

    – Duy Đặng
    Nov 15 '18 at 14:26











  • don't worry, this resolved your issue?

    – Alesandro Giordano
    Nov 15 '18 at 14:32











  • i understand the "if -else " issue but do you have any idea to fix the 'parentNode' ? any better way ?

    – Duy Đặng
    Nov 16 '18 at 3:30











  • Please first rate answer if has resolved your issue

    – Alesandro Giordano
    Nov 16 '18 at 6:14











  • Hello, can you help me 1 more question ?? i edited if-else statement with else if but it wont run the "2nd if", i used console.log(searchChar.length) to check if the value is '0' , its true but the second if wont run unless i remove the "else"

    – Duy Đặng
    Nov 16 '18 at 9:11



















  • i added my question , i'm really sorry for any confuse with my English

    – Duy Đặng
    Nov 15 '18 at 14:26











  • don't worry, this resolved your issue?

    – Alesandro Giordano
    Nov 15 '18 at 14:32











  • i understand the "if -else " issue but do you have any idea to fix the 'parentNode' ? any better way ?

    – Duy Đặng
    Nov 16 '18 at 3:30











  • Please first rate answer if has resolved your issue

    – Alesandro Giordano
    Nov 16 '18 at 6:14











  • Hello, can you help me 1 more question ?? i edited if-else statement with else if but it wont run the "2nd if", i used console.log(searchChar.length) to check if the value is '0' , its true but the second if wont run unless i remove the "else"

    – Duy Đặng
    Nov 16 '18 at 9:11

















i added my question , i'm really sorry for any confuse with my English

– Duy Đặng
Nov 15 '18 at 14:26





i added my question , i'm really sorry for any confuse with my English

– Duy Đặng
Nov 15 '18 at 14:26













don't worry, this resolved your issue?

– Alesandro Giordano
Nov 15 '18 at 14:32





don't worry, this resolved your issue?

– Alesandro Giordano
Nov 15 '18 at 14:32













i understand the "if -else " issue but do you have any idea to fix the 'parentNode' ? any better way ?

– Duy Đặng
Nov 16 '18 at 3:30





i understand the "if -else " issue but do you have any idea to fix the 'parentNode' ? any better way ?

– Duy Đặng
Nov 16 '18 at 3:30













Please first rate answer if has resolved your issue

– Alesandro Giordano
Nov 16 '18 at 6:14





Please first rate answer if has resolved your issue

– Alesandro Giordano
Nov 16 '18 at 6:14













Hello, can you help me 1 more question ?? i edited if-else statement with else if but it wont run the "2nd if", i used console.log(searchChar.length) to check if the value is '0' , its true but the second if wont run unless i remove the "else"

– Duy Đặng
Nov 16 '18 at 9:11





Hello, can you help me 1 more question ?? i edited if-else statement with else if but it wont run the "2nd if", i used console.log(searchChar.length) to check if the value is '0' , its true but the second if wont run unless i remove the "else"

– Duy Đặng
Nov 16 '18 at 9:11




















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53303619%2fboth-if-else-is-true%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Lugert, Oklahoma