2016-05-04 10 views
1

私はCでJavascriptの同等()

<input type="text" id="input"> 

を使用して1つの関数にユーザーに質問のシリーズをお願いしたい、のscanf()関数を使用すると、ユーザーの応答を待ち、ユーザーが入力した場合を続行することができます価値。 Javascriptでは、prompt()を使わずに関数内でユーザーの応答を待つ方法はありますか?

+0

それがポップアップする必要もありませんJavaScriptの機能がありますか?これはhttp://stackoverflow.comを助けている場合を参照してください。/questions/17437147/javascript-prompt-alternative –

答えて

0

jsでonChangeを使用できます。

$(document).on('change','#input',function(e){ 
    e.preventDefault 
}); 
0

デフォルトはprompt();

参照

<!DOCTYPE html> 
 
<html> 
 
<body> 
 

 
<p>Click the button to demonstrate the prompt box.</p> 
 

 
<button onclick="myFunction()">Try it</button> 
 

 
<p id="demo"></p> 
 

 
<script> 
 
function myFunction() { 
 
    var person = prompt("Please enter your name", "Harry Potter"); 
 
    if (person != null) { 
 
     alert(person); 
 
    } 
 
} 
 
</script> 
 

 
</body> 
 
</html>

+0

コメントありがとう私は自分の答えを更新しました。 –