我与WP媒体库发生了一些冲突,当我在实现以下js时尝试插入图像时,无法切换到从URL插入。控制台向我显示:未捕获的TypeError:a.is不是函数。
var originalVal = $.fn.val;
$.fn.val = function(value) {
//is it a radio button? treat it differently.
if($(this).is("[type=radio]")) {
if (typeof value != 'undefined') {
//setter
changeRadioButton(this, value);
return $(this);
} else {
//getter
var textValue = $("input[name=section_home_page_field]").val(getRadioButton(this));
return getRadioButton(this);
}
}
else {
//it wasn't a radio button - let's call the default val function.
if (typeof value != 'undefined') {
return originalVal.call(this, value);
} else {
return originalVal.call(this);
}
}
}
基本上,这里
else {
//it wasn't a radio button - let's call the default val function.
if (typeof value != 'undefined') {
return originalVal.call(this, value);
} else {
return originalVal.call(this);
}