jQuery属性长度未定义 [英] Jquery length of attribute undefined
本文介绍了jQuery属性长度未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何检查属性中字符串的长度?这显示了'undefined'值:
How can I check the lenght of the string that is in the attribute?This shows 'undefined' value:
var action = $(obj).closest("form").attr('action');
alert(action.lenght);
var action = $(obj).closest("form").attr('action');
alert(action.lenght);
推荐答案
Your spelling is just a bit off, .lenght
should be .length
:
var action = $(obj).closest("form").attr('action');
alert(action.length);
这篇关于jQuery属性长度未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文