I have a div that has hidden text.This text can only be displayed if the text contents of another div equal a string. To do this, i wrote the function below:
function show() {
if(typeof genDiv.innerHTML == "string") {
showDiv.innerHTML = fullhiragana[h];
} else {
alert("Please generate the Romaji before requesting the Hiragana to be displayed.");
}
}
//fullhiragana is an array that has the data that 'showDiv' is supposed to display.
'h' is a var that randomly picks a string from fullhiragana.//
In a way, it works. It displays the text if I press the button, but it does this regardless of the type of content in the other div. It even works if there is no content in the first div. Maybe I've constructed the if conditional wrong? Help please! see this printscreen for further reference of the problem; http://prntscr.com/5o7q59