$("[name*='ecId_']").each(function(i){}代表什么意思啊????

本文介绍如何使用jQuery的$("input[name='grpid']")选择器来遍历页面上所有name属性为'grpid'的input元素,并通过.each()方法进行逐个处理。此外,还展示了如何检查这些input元素是否被选中,并获取其值。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

jquery?
$("input[name='grpid']").each(function(){
    //处理方法
});

依次遍历上下文所有的含有name=grpid的input..each就表示每一个,
处理方法那边你可以写一些判定或者其他处理方法
在方法体中,你可以用$(this)来代表当前正选中的那一个控件... 
例如:页面有三个input
<input name="grpid" value="2" />
<input name="grpid" value="1" />
<input name="grpid" value="3" />
遍历输出它们的值就可以这样写:
$("input[name='grpid']").each(function(){
    alert($(this).val());
});
它就会依次弹窗输出2,1,3
追问
还有这是我的 function checkGrpid() { //判断选择群组
		var checkedvals = "";
		$("input[name='grpid']").each(function(i) {
			if ($(this).attr("checked")) {
				var id = $(this).val();
				checkedvals = id;
			}
		});看看怎么解释
回答
你这个,等于是把最后一个checked的值赋给checkedvals啊..
请求异常,url: [http://fabc-eap-prod.sienidm.com/webservice/api/eapSettings/importGemSettings],原因: [ ### Error updating database. Cause: com.huawei.gauss.exception.GaussException: [errorCode=GS-00601, SQLState='28000', reason='errLine = 7, errColumn = 15, errMsg=Sql syntax error: (...) expected but found,ioClient:@4c0476d7', sessionId=1724, serverIP=10.13.171.158:15400, clientIP=127.0.0.1.] ### The error may exist in URL [jar:file:/app.jar!/BOOT-INF/lib/eap-common-1.0.0-SNAPSHOT.jar!/mapper/EapGemSettingsMapper.xml] ### The error may involve com.taia.eap.center.common.mapper.EapGemSettingsMapper.batchInsertEapGemSetting-Inline ### The error occurred while setting parameters ### SQL: insert into t_eapmgr_gem ( id, name, gem_json_vid, gem_json_report, gem_json_ceid,gem_json_ecid,gem_json_dataFormats,gem_json_alarm, description,version, status, creation_date, created_by_name ) values ### Cause: com.huawei.gauss.exception.GaussException: [errorCode=GS-00601, SQLState='28000', reason='errLine = 7, errColumn = 15, errMsg=Sql syntax error: (...) expected but found,ioClient:@4c0476d7', sessionId=1724, serverIP=10.13.171.158:15400, clientIP=127.0.0.1.] ; uncategorized SQLException; SQL state [28000]; error code [601]; [errorCode=GS-00601, SQLState='28000', reason='errLine = 7, errColumn = 15, errMsg=Sql syntax error: (...) expected but found,ioClient:@4c0476d7', sessionId=1724, serverIP=10.13.171.158:15400, clientIP=127.0.0.1.] ; nested exception is com.huawei.gauss.exception.GaussException: [errorCode=GS-00601, SQLState='28000', reason='errLine = 7, errColumn = 15, errMsg=Sql syntax error: (...) expected but found,ioClient:@4c0476d7', sessionId=1724, serverIP=10.13.171.158:15400, clientIP=127.0.0.1.] ] org.springframework.jdbc.UncategorizedSQLException: ### Error updating database. Cause: com.huawei.gauss.exception.GaussException: [errorCode=GS-00601, SQLState='28000', reason='errLine = 7, errColumn = 15, errMsg=Sql syntax error: (...) expected but found,ioClient:@4c0476d7', sessionId=1724, serverIP=10.13.171.158:15400, clientIP=127.0.0.1.] ### The error may exist in URL [jar:file:/app.jar!/BOOT-INF/lib/eap-common-1.0.0-SNAPSHOT.jar!/mapper/EapGemSettingsMapper.xml] ### The error may involve com.taia.eap.center.common.mapper.EapGemSettingsMapper.batchInsertEapGemSetting-Inline ### The error occurred while setting parameters ### SQL: insert into t_eapmgr_gem ( id, name, gem_json_vid, gem_json_report, gem_json_ceid,gem_json_ecid,gem_json_dataFormats,gem_json_alarm, description,version, status, creation_date, created_by_name ) values ### Cause: com.huawei.gauss.exception.GaussException: [errorCode=GS-00601, SQLState='28000', reason='errLine = 7, errColumn = 15, errMsg=Sql syntax error: (...) expected but found,ioClient:@4c0476d7', sessionId=1724, serverIP=10.13.171.158:15400, clientIP=127.0.0.1.] ; uncategorized SQLException; SQL state [28000]; error code [601]; [errorCode=GS-00601, SQLState='28000', reason='errLine = 7, errColumn = 15, errMsg=Sql syntax error: (...) expected but found,ioClient:@4c0476d7', sessionId=1724, serverIP=10.13.171.158:15400, clientIP=127.0.0.1.] ; nested exception is com.huawei.gauss.exception.GaussException: [errorCode=GS-00601, SQLState='28000', reason='errLine = 7, errColumn = 15, errMsg=Sql syntax error: (...) expected but found,ioClient:@4c0476d7', sessionId=1724, serverIP=10.13.171.158:15400, clientIP=127.0.0.1.] at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:92) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441) at com.sun.proxy.$Proxy168.insert(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272) at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59) at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:148) at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89) at com.sun.proxy.$Proxy188.batchInsertEapGemSetting(Unknown Source) at CC00000067CF9BB502E16E556BDD2244.vm_object(Native Method) at com.taia.eap.center.ws.service.common.impl.EapSettingsServiceImpl.importGemSettings(EapSettingsServiceImpl.java:1573) at CC00000067CF9BB502E16E556BDD2244.vm_object(Native Method) at com.taia.eap.center.ws.controller.webservice.EapSettingsController.importGemSettings$original$9Jb7WA7T(EapSettingsController.java:252) at com.taia.eap.center.ws.controller.webservice.EapSettingsController.importGemSettings$original$9Jb7WA7T$a
最新发布
08-05
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值