1
我已創建下面Laravel刀片語法形式:無法追加刀片語法與jQuery
<div class="form-group" id="addstudent">
{!! Form::label('student_name', 'Student Name :') !!}
{!! Form::select('student_name', $students, null, ['class' => 'form-control', 'name' => 'student_id[]']) !!}
</div>
<div class="form-group">
{!! Form::button('Add More Student', ['class' => 'btn btn-info', 'id' => 'btnaddstudent']) !!}
</div>
,並與下面的jQuery代碼:
<script>
$(document).ready(function(){
$("#btnaddstudent").click(function(){
$("div#addstudent").append("<div class='form-group'>{!! Form::label('student_name', 'Student Name :') !!}{!! Form::select('student_name', $students, null, ['class' => 'form-control', 'name' => 'student_id[]']) !!}</div>");
});
});
</script>
我試圖追加傳遞addStudent ID,以便每次用戶在我的按鈕,單擊窗體將追加下面的刀片語法:
<div class="form-group">
{!! Form::label('student_name', 'Student Name :') !!}
{!! Form::select('student_name', $students, null, ['class' => 'form-control', 'name' => 'student_id[]']) !!}
</div>
,並沒有爲我工作。無論如何,這是解決問題的方法嗎?謝謝