我正在使用this multiSelect插件。
刀片模板
/tmp % gcc -pedantic -Wextra c.c
/tmp % cp c.c exercise1.txt
/tmp % ./a.out
#include<stdio.h>
#include<stdlib.h>
int main()
{
FILE * fPointer = fopen("exercise1.txt","r");
if (fPointer == NULL)
puts("cannot open exercise1.txt");
else {
char singleline[150];
while (fgets(singleline, sizeof(singleline), fPointer))
fputs(singleline, stdout);
fclose(fPointer);
}
return 0;
}
/tmp % \rm exercise1.txt
/tmp % ./a.out
cannot open exercise1.txt
jQuery代码
<form method="POST" id="report-form" action="{{ route('admin.reports.store') }}" aria-label="{{ __('Create Report') }}">
{{ csrf_field() }}
<div class="row">
<div class="form-group col-md-6">
<label class="control-label mb-10 text-left" for="tableName">Choose Table</label>
<select class="form-control" name="tableName" id="tableName">
<option>Choose</option>
@foreach ( $tables as $table )
<option value="{{ $table }}">{{ slugFormat($table) }}</option>
@endforeach
</select>
@if ($errors->has('tableName'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('tableName') }}</strong>
</span>
@endif
</div>
<div class="col-md-6">
<label class="control-label mb-10 text-left" for="columns">Select Column</label>
<select class="form-control" name="columns[]" id="columns">
<option>Choose</option>
</select>
@if ($errors->has('column'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('column') }}</strong>
</span>
@endif
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group mb-0 pull-right">
<button name="submit" type="submit" class="btn btn-primary">submit</button>
</div>
</div>
</div>
</form>
当我更改表选择时,我会在#columns选择框中获取属于该表的列,现在,如果我从#columns Seelect框中选择某些列并更改表,那么它也在清除所选值,我需要检查来自多个表的多个列。
Github Code显示了插件的基本实现。