简体   繁体   English

如何从表单变量对象的属性中获取特定信息

[英]How to get specific from attributes from a form variable object

Please I have a little problem, i want to retrieve or set the form attribute found in a variable.请我有一个小问题,我想检索或设置在变量中找到的表单属性。 The variable contains a form object, for which i suppose I should be able to get for example an input field with the id="cusID".该变量包含一个表单对象,我想我应该能够获得例如带有 id="cusID" 的输入字段。 I have tried this but it doesnt seem to do what i want.我试过这个,但它似乎没有做我想要的。 Any idea what I am missing知道我错过了什么

var form = $('form[data-validate="true"][id="form"]');

So now if i want to access the elements on the selected form , i do this所以现在如果我想访问所选表单上的元素,我会这样做

var check = ( form +'[id=CusID], '+ form +'[id=email]');

But I get this [object Object][id=CusID], [object Object][id=email]" what am I doing wrong?但是我得到这个 [object Object][id=CusID], [object Object][id=email]”我做错了什么?

try find :-尝试find :-

var check = $(form).find('[id=CusID],[id=email]');

or:-或者:-

$('#CusID, #email');

As id 's must/should be unique.因为id必须/应该是唯一的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM