I am getting Function Reference undefined error while i add new Dynamic Fields. Note that I have split my bladed files into different parts or sections. but the function is defined in the same file. So basically i have a different- different part of files to make code easier to read. but the problem is when i write a function in a different file and mention that function name in the different file where all files part being included in one file. after that, i am getting errors many times like this `foo is not defined. in other words, all part of the files is included in one file. let’s check my code.
it is a script file in blade: script.blade.php
<script>
var count_custom_field =0;
$(document).on('click', '.new-row-weekly', function () {
count_custom_field++;
$(' <div class="clearfix field_'+count_custom_field+'" > </div> ' +
' <div class="row field_'+count_custom_field+'"> <div class="col-md-4"> ' +
' <label class="text-label"> Repeat Day </label> {{ Form::select("repet_days[]",
$days,null,array("class" => "form-control")) }} </div> '+
' <div class="col-md-4"> ' +
' <label class="text-label"> Repeat Return Halt Duration(Minutes) </label>{!! Form::text("repet_times[]", null,
array("class" => "form-control repet_times" , "placeholder"=>"Ex. 120" ) ) !!}
</div>'+
' <div class="btn btn-danger" onClick="removeCustFiled(213123)" style="margin: 30px 0 0 0; height: 40px; padding-bottom: 18px;" > <i class="fa fa-close"></i> </div> </div> '+
'</div>' ).appendTo('#weekly').hide().fadeIn(280);
}
function removeCustFiled( ref ) { console.log(ref);
/* $('.'+ref+'').remove();
if( Number( count_custom_field ) > 0)
{
count_custom_field--;
}*/
}
</script>
Please tell me what is reason i am getting this error.