Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Zheng Liao

Forum Replies Created

Viewing 1 post (of 1 total)
  • Zheng Liao in reply to:
    Add "Checked" in Input Attributes
    #19003

    hello Ross,

    just when I use firebug, I cannot see checked=”checked” within the <input> tag?

    I wrote a piece of JQuery code to change the default style as below, but it doesn’t add checked=”checked” to <input> and “checkedbox” class to <span> either as it is supposed to, do you have any idea why?

    my code:
    $(‘input:checkbox’).hide().each(function() {
    $(this).attr(‘data-check-fx’, this.value);
    var label = $(“label[for=” + ‘”‘ + this.id + ‘”‘ + “]”).text();
    $(‘‘+'<span class=”checkbox’ + (this.checked ? ‘ checkbox-checked’ : ”) + ‘”></span>‘).insertAfter(this);
    });

    $(‘sf-field-tag label’).on(‘click’, function(e) {
    e.preventDefault();
    if($(this).find(‘input:checkbox’).is(‘:checked’)) return;
    var unique = $(this).find(‘a.check-fx’).attr(‘data-check-fx’);
    $(“sf-field-tag label a[data-check-fx='”+unique+”‘] span”).attr(‘class’,’checkbox’);
    $(“sf-field-tag label input:checkbox[data-check-fx='”+unique+”‘]”).attr(‘checked’,false);
    $(this).find(‘a.check-fx’).find(‘span’).attr(‘class’,’checkbox-checked’);
    $(this).find(‘input:checkbox’).attr(‘checked’,true);
    }).on(‘keydown’, function(e) {
    if ((e.keyCode ? e.keyCode : e.which) == 32) {
    $(this).trigger(‘click’);
    }
    });

    Thanks!
    Emma

Viewing 1 post (of 1 total)