遇到
未捕获的TypeError:$(...)。modal不是函数错误
当我尝试使用2
我不认为这是脚本参考问题,因为打开模式时不会出现任何错误,只有单击关闭并尝试执行dispose函数时,才会出现错误。
包含的库
const product1 = {
number: '00005598001400248980',
type: 'TC'
},
product2 = {
number: '00000377820202008104',
type: 'TA'
},
/**
* @const clearMerge a function that replaces the leading zeros and returns the first 6 digits and the last 4 digits.
* @param n the number to be cleaned and merged.
**/
clearMerge = n => {
/**
* 1. replace leading zeros
* 2. get the first 6 digits and the last 4 digits
* 3. concatenate the digits and cast them to an integer (using "+" operator)
* 4. return the final number
**/
const value = +n.replace(/^0+/, ''),
matched = /^(\d{6}).*(\d{4})$/.exec(value);
return +(`${matched[1]}${matched[2]}`);
};
console.log(clearMerge(product1.number)); /** utput: 5598008980 **/
jQuery处理代码:
$('#editAppModal').modal('dispose');
错误发生在<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/start/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script src="~/js/jquery-3.4.1.min.js"></script>
<script src="~/js/bootstrap-4.3.1.bundle.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.8/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.8/js/select2.min.js"></script>
行。