我必须将OnKeyPress
事件附加到 SharePoint 多行列,文本类型为 "Enhance Rich Text"。以下是我正在使用的 jscript 代码
<script>
var ele=document.getElementById(inpID);
if(ele!=null){
ele.onkeypress=function(){calLen(this);};
}
function calLen(obj)
{
if(obj.value.length>=5){
alert('Cannot exceed character limit 5');
obj.value=obj.value.substring(0,5);
}
</script>
但该事件没有得到附加。
文本类型为 "Plain Text"的 SharePoint 多行文本框运行良好。
有人可以帮我解决这个问题吗...?