phpを使ってテキストボックスの値をエコーしたい。どのようなユーザーの値であるため、トップの量をエコーするだけでなく、それのように別のテキストボックスに表示されるようテキストボックスにタイプの文字:(何であれは、テキストボックスに入力される) をここでは、ここでscreenshotphpでsubmitとonclick関数を使わずにテキストボックスの値をエコーする
ですコード:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<?php
if(!empty($_GET['a1']))
{
$selected = $_GET['a1'];
}
else
{
$selected = 'home';
}
if(!empty($_GET['a1']))
{
$selected = $_GET['a1'];
}
else
{
$selected = 'home';
}
?>
<span class="r-text" style="font-weight:bold;">Value is</span>
<form action="" method="post">
<label>
<input type="radio" name="a1" value="100" /> 100
</label>
</br>
<label>
<input type="radio" name="a1" value="200" /> 200
</label>
</br>
<label>
<input type="radio" name="a1" value="300" /> 300
</label>
</br>
<label>
<input type="radio" name="a1" value=" " /> Other
</label>
</br>
<input type="text" name="a1"/>
<br/>
<br/>
Amount
<input type="text" name="a2" />
<br/>
<br/>
</form>
<script>
$('input[type=radio]').click(function(e) {//jQuery works on clicking radio box
var value = $(this).val(); //Get the clicked checkbox value
var check = $(this); //Get the clicked checkbox properties (like ID, value, class etc)
$('.r-text').html('Value is '+value);// The class r-text after clicked checkbox print the line 'This was selected'
});
</script>
<script>
$('input[type=text]').click(function(e) {//jQuery works on clicking radio box
var value = $(this).val(); //Get the clicked checkbox value
var check = $(this); //Get the clicked checkbox properties (like ID, value, class etc)
$('.r-text').html('Value is '+value);// The class r-text after clicked checkbox print the line 'This was selected'
});
</script>
'onKeyUp'イベントハンドラを追加できます。 –
Jqueryを使用します。ユーザーが入力する要素にIDを割り当て、そのid + val()を表示する他のテキストボックスに割り当てます。 –
どうすれば使えますか? – user3168637