Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The plugin return label "null". #76

Closed
ve3 opened this issue May 29, 2014 · 12 comments
Closed

The plugin return label "null". #76

ve3 opened this issue May 29, 2014 · 12 comments

Comments

@ve3
Copy link

ve3 commented May 29, 2014

HTML copy from your website.

<div class="input-wrapper">
              <label for="Test1">Right positioned label (no params)</label>
              <input type="checkbox" class="prettyCheckable" value="1" id="Test1" name="Test1" checked/>
            </div>

            <div class="input-wrapper">
              <input type="checkbox" class="prettyCheckable" value="3" id="TestDisabled" name="TestDisabled" disabled data-label='Existing "disabled" attribute'>
            </div>
$('.prettyCheckable').prettyCheckable();

prettycheckbox

Jquery 2.x
prettyCheckable: 2.1.2
Bootstrap 3.1.1
Firefox 29.0.1

@arthurgouveia
Copy link
Owner

Are you calling .prettyCheckable on each?

Check the documentation. You need a for loop and instantiate it on each
checkable.
On May 29, 2014 3:29 PM, "vee w," [email protected] wrote:

HTML copy from your website.

Right positioned label (no params)
        <div class="input-wrapper">
          <input type="checkbox" class="prettyCheckable" value="3" id="TestDisabled" name="TestDisabled" disabled data-label='Existing "disabled" attribute'>
        </div>

$('.prettyCheckable').prettyCheckable();

[image: prettycheckbox]
https://cloud.githubusercontent.com/assets/1568262/3121653/d18cd668-e75e-11e3-9f96-0ee3029c2a47.jpg

Jquery 2.x
prettyCheckable: 2.1.2
Bootstrap 3.1.1
Firefox 29.0.1


Reply to this email directly or view it on GitHub
#76.

@beaterpc
Copy link

same problem here.
http://jsfiddle.net/beater/mrf3U/

@arthurgouveia
Copy link
Owner

@ve3
Copy link
Author

ve3 commented Jun 25, 2014

loop and instantiate it on each checkable works.

@beaterpc
Copy link

data-label is required then?
"If informed, this will create a label attached to the input."
IF

@arthurgouveia
Copy link
Owner

I believe this bug was introduced with the label auto detection. Are you using any labels at all for your input?

Can you open an issue explaining that if no label is provided, either by inline options or auto detected, the null is showing up?

@baltazorr
Copy link

I think, It was fixed in my pull request #81

@0xadri
Copy link

0xadri commented Feb 11, 2016

This is still NOT fixed.

See this fiddle https://jsfiddle.net/eqsfsrh3/

@baltazorr
Copy link

My pull request was rejected because there was a lot of changes. If you need my changes you can merge this request locally on your machine.

@0xadri
Copy link

0xadri commented Feb 11, 2016

Thanks a lot, but I'd rather stick with the official version for now.

I used this trick for now:

  1. add a custom class to the parent div, via data-customClass attribute such as: data-customClass="no-label"
  2. add the relevant CSS such as: .no-label label { display: none;}

Simple enough to be an acceptable work around in my opinion.

@0xadri 0xadri mentioned this issue Feb 16, 2016
@0xadri
Copy link

0xadri commented Feb 16, 2016

Ended up using a combination of JS & CSS.

On the Javascript/jQuery side:

$('input:checkbox, input:radio').each(function(){
  $(this).prettyCheckable();
  var labelValue = $(this).data('label') || '';
  if( (!labelValue || 0 === labelValue.length) ){
    $(this).parent().addClass('no-label');
  }
});

And on the CSS side:

.no-label label {
  display: none !important;
}

@ufocruz
Copy link

ufocruz commented May 16, 2018

I fixed it using an label for each input and inserted an for on each label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants