手风琴问题标题中的无线电输入?BUG [英] Radio input in header of accordion problem ?BUG

查看:85
本文介绍了手风琴问题标题中的无线电输入?BUG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已解决!

$('#bset1').click(function(event) {                                                                 
    event.stopPropagation();                                                                                    
    });        

元素中有几个单选按钮。一切正常,但是当我向父div添加.accordion()时,单选按钮停止工作(在初始选择后

I have several radio buttons in the element. Everything works fine, but when I add .accordion() to the parent div, radio buttons stop working (after the initial selection)

此处是链接:
http://jsfiddle.net/Lrnj8/5/

删除手风琴的创建以查看区别

remove accordion creation to see the difference

$('[id^=rad]').click (function () {return false;}) 

没有帮助

过去一周我一直在为此苦苦挣扎!最后,我编写了自己的.click()处理函数,但肯定有一种更简单的方法!

I've been struggling with this for the past week! In the end, I wrote my own .click() handler, but there must be an easier way!

$(function() {                                                                                                      
$("body")                                                                                                       
    .append($('<div/>')                                                                                         
        .attr ('id','main'));                                                                                   
var str1='<input type=radio id=rad1 name=r1><label for=rad1>1</label>'                                          
    +'<input type=radio id=rad2 name=r1><label for=rad2>2</label>'                                              
    +'<input type=radio id=rad3 name=r1><label for=rad3>3</label>';                                             

$('#main')                                                                                                      
    .append($("<h3/>")                                                                                          
        .append ($('<a>')                                                                                       
        .attr ({                                                                                                
        'id':'header1'                                                                                          
        })                                                                                                      
        .html('HEADER'))                                                                                        
        .append($('<span\>')                                                                                    
            .attr ('id','bset1')                                                                                
            .html (str1)                                                                                        
            ))                                                                                                  
//php takes care of that                                                                                                               
if (1==$_GET['a'])  $('#main').accordion();                                                         

}) 


推荐答案

$('#bset1').click(function(event) {
    event.stopPropagation();
});        

这篇关于手风琴问题标题中的无线电输入?BUG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆