テキストの長さが2より大きいときにdivを表示する関数を作成しましたが、動作していないようです。テキストの入力が2より大きいとdivが表示される
jsfiddle:あなたは、入力値をテストする必要がありますhttps://jsfiddle.net/bj22met8/
javascriptの
function showDIV(){
text = document.getElementById("search");
if (text.length >=1){
document.getElementById("section").style.visibility =
"visible";
}
}
HTML
<div id="section">
dsfdsf
</div>
<input type="text" id="search" size="20" onkeydown="showDIV();">
スタイル
#section{
width: 200px;
height: 200px;
background-color: blue;
visibility: hidden;
}
'テキストは=のdocument.getElementById( "検索")[値]、これはコード取り組んでいる –
そもそも:。https://jsfiddle.net/bj22met8/6/ –