Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.7k views
in Technique[技术] by (71.8m points)

如何解决在bootstrap中radio无法使用onchange和onclick?

如题,在对应radio中使用onchange、onclick都无反应,求指教如何解决?谢谢

<input class="xb-icheck" type="radio" name="shoukejianyi" value="1" checked="checked">
<input class="xb-icheck" type="radio" name="shoukejianyi" value="0">

使用了bootstrap css框架,页面生成之后是这样子的
image.png

不管是用jq通过class还是id都无法触发onchange、onclick,但是不引入bootstrap css框架就可以触发


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

怀疑绑定出了问题,可以试试这种:

$(document).on('click', '.xb-icheck', function(){
  //Your code
});

希望能帮助到你。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...