0
私は入力フィールドを持つHTMLフォームを持っています。私は入力フィールドから処理するためにJavaScript関数に渡すためにデータを取得しようとしています。私は「tenantid」が、私が得る唯一のもの、の値を取得しようとしていますポップアップの値を表示する場合:入力値をlaravelのjavascriptに渡します
がどのように私は、フォームに入力された値を取得することができます
最初objectHMTLFormElementをJavascriptコード?
TIA
私が持っている: testing.blade.php
<script type="text/javascript" src="{{ URL::asset('js/test.js') }}"> </script> [.. snip ..] <form id="oogie" class="form-horizontal" role="form" method="POST" action="{{ url('') }}/dashboard"> {{ csrf_field() }} <div class="form-group{{ $errors->has('tenantid') ? ' has-error' : '' }}"> <label for="tenantid" class="col-md-4 control-label"> Tenant ID </label> <div class="col-md-6"> <input id="tenantid" type="integer" class="form-control" name="tenantid" value="{{ old('tenantid') }}" required autofocus> @if ($errors->has('tenantid')) <span class="help-block"> <strong>{{ $errors->first('tenantid') }}</strong> </span> @endif </div> </div> </form> [... snip ...] <button class="ClickMe" onclick="testme();">Click me</button>
test.jsスクリプトがアクセスしようとされていないためだ
function testme() { alert("got in"); var parameters = document.getElementById("oogie"); alert("first " + parameters); }
ありがとうございました。 –
あなたは歓迎です –