我在将字符串值从 jQuery 插件传递给回调函数时遇到问题:
这是插件中的代码
tempField.on("keydown", function (e){
if (e.which === 13) {
var hiddenField = $('input[name="hiddenField"]');
var textValue = $(this).val();
var textColor = settings.color;
var font = settings.textSize;
var removeInputHandle = $(this).remove();
var setText = textElement.show();
}
if(textValue != ""){
hiddenField.val(textValue).change();
textElement.text(textValue);
textElement.css("color", textColor);
textElement.css("font-size", font);
settings.callback(textValue);
}
if(e.keyCode === 13){
removeInputHandle;
setText;
}
return textValue;
});
和来自主 js 文件的代码
var setTitle = function (title){
title = presTitle;
var presTitle = app.presentation.title;
console.log(presTitle);
};
$("#presentationTitle").inline({
callback: setTitle
});
现在,这里的回调函数是通过 $.extend 函数替换插件文件中定义的回调函数(只是为了不让人感到困惑)。
我正在尝试使用 textValue 来设置对象中字段的值。但是这个值需要是一个字符串......并且该值不是作为字符串传递的,而是被解释为未定义或空值;尽管它给出了 alfa 数值。
前任:
比如说,我输入了输入字段,someinputinthisinputfield。该值将是此输入字段中的某个输入。
我需要它是“someinputinthisinputfield”。
任何帮助将不胜感激。