I need show selection id by js, by this code only show 1 and first select id
my code is this html and javascript
4条回答 死守一世寂寞 (楼主) 2021-01-26 06:03 Try with each() function of jquery .And change the selector with Tagname or ClassName instead of id .Id is a unique for full document $(document).ready(function() { $('select').each(function(){ console.log($(this).val()) }) }); 1 2 1 2 0 讨论(0) 查看其它4个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复 热议问题
Try with each() function of jquery .And change the selector with Tagname or ClassName instead of id .Id is a unique for full document
each()
Tagname
ClassName
id
$(document).ready(function() { $('select').each(function(){ console.log($(this).val()) }) });
1 2 1 2