jquery 选择id

<inputtupe="buttom"id="a1"/><inputtupe="buttom"id="a2"/><inputtupe="buttom"id="a3"/>$... <input tupe="buttom" id="a1"/>
<input tupe="buttom" id="a2"/>
<input tupe="buttom" id="a3"/>

$("#a").click(function(){
..................
})
想点击任意一个按钮都能到jq里去
展开
 我来答
风清云淡月
2017-07-24 · TA获得超过209个赞
知道小有建树答主
回答量:230
采纳率:68%
帮助的人:32.6万
展开全部
方法一:直接给每个按钮添加属性onclick=‘thisBut()’
然后在<script></script>中写函数:
function thisBut(){
$(this).后面接你想要的代码
}
方法二:
script中写:
$("[type='button']").click(function(){
$(this).后面跟你想要的代码
})
lym20li
2017-07-24 · TA获得超过271个赞
知道小有建树答主
回答量:317
采纳率:16%
帮助的人:129万
展开全部
写错了,大兄弟,<input type="button" value="1"><input type="button" value="2"><input type="button" value="3">
$("input").click(function(){});
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式