开发者

jqTransformReset() for the jqtransform form (Reset Button)

Does anyone have a complete code example for the jqTransformReset() for the jqtransform form? My ultimate goal is to add a reset button to the form and reset all form fields (especially checkboxes which I 开发者_如何转开发can't get to reset). Thanks in advance!


whenever I call document.form.reset() I also call

$(".jqTransformCheckbox").each(function(){ if($(this).hasClass('jqTransformChecked')) $(this).removeClass('jqTransformChecked');});

seems to work fine.


jqTransform wouldn't reset select boxes for me or check boxes, so I made this bit of code and it seems to work well. (I used nando's code for the checkboxs, thanks nando)

$('.jqTransformButton[type="reset"]').click(function(){
    $(".jqTransformCheckbox").each(function(){
        if($(this).hasClass('jqTransformChecked')) {
            $(this).removeClass('jqTransformChecked');
        }
    });
    $('.jqTransform select').each(function(){
        var firstOpt = $(this).find('option:first-child');
        var firstVal = firstOpt.val();
        firstOpt.attr("selected", "selected");
        $(this).siblings('div').find('span').text(firstVal);
        $(this).siblings('ul').find('a.selected').removeClass('selected');
        $(this).siblings('ul').find('li:first-child a').addClass('selected');
    })
})
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜