drgullin / icheck

Highly customizable checkboxes and radio buttons (jQuery & Zepto)
http://fronteed.com/iCheck
7.38k stars 1.62k forks source link

Preserving tooltips/titles for checkboxes #96

Closed deanbolton closed 10 years ago

deanbolton commented 10 years ago

Firstly, great plugin. Thank you!

Question... is it possible to preserve tooltips for checkboxes? The title is set in the original markup but not referenced/used/applied when this plugin works its magic and transforms a checkbox.

drgullin commented 10 years ago

Attribute inheritance would be a nice feature, thanks. I think this should be supported out of the box.

You can do it right now using ifCreated callback:

$('input').on('ifCreated', function(event) {
  if (this.title) {
    $(this).parent().attr('title', this.title);
  }
});
deanbolton commented 10 years ago

Again, thank you! That's what I was looking for. I'm new to all this, so I've included code with complete syntax for my fellow noobs.

$('input').on('ifCreated', function(event) {
    if ($(this).attr('title')) {
        $(this).parent().attr('title', $(this).attr('title'));
    }
});
drgullin commented 10 years ago

iCheck 2.x supports inherit option https://github.com/fronteed/iCheck/tree/2.x-beta, that can be used to inherit any attribute.