0
现在用下面的代码在运行时改变类jQuery的事件的内容jQuery的添加删除类
$("#txtNewAttributes").focusout(function() {
var attributeTextBox = $("#txtNewAttributes").val()
if ($.trim(attributeTextBox) == "Height")
$(txtNewValues).removeClass('alphaonly').addClass('numbersonly');
if ($.trim(attributeTextBox) == "string" || $.trim(attributeTextBox) == "string2")
$(txtNewValues).removeClass('numbersonly').addClass('alphaonly');
});
并使用页面加载的类名时遇到了验证。
我的问题是在FireBug我看到班级名称已更改为txtNewValues
,但仍然期望的验证(仅限alphaonly,numbersonly)不会被解雇。
我在这里错过了什么吗?
你能为它添加一个提琴手吗? – 2013-03-01 09:29:55
与[tag:jquery-validate]插件无关。已移除标记。 – Sparky 2013-03-01 16:04:06