Jquery removeAttr('title'); problem

Hello experts.
Using this http://jsfiddle.net/AlexCode/b2GPv/129/ to create jquery ui check boxes i have a problem. I want to remove the title attribute of the created buttons.
The $( this ).removeAttr( "title" ); does not the job.
Any help?
(the above link is a very nice solution of this question: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/Q_28623177.html#a40629191)
LVL 2
PanosAsked:
Who is Participating?
 
JonNormanCommented:
The checkbox() function adds the title attr. so after calling it you can remove it:

$(function() {
  $( "input[type='checkbox']" ).checkbox();
  $("button.ui-checkbox").removeAttr("title");
});
0
 
JonNormanCommented:
full code:

(function( $ ) {
   
    $.widget( "app.checkbox", {
   
        _create: function() {

            // Call the default widget constructor first.            
            //this._super();
            var w = this;
           
            // Hide the HTML checkbox, then insert our button.
            w.element.addClass( "ui-helper-hidden-accessible" );
            w.button = $( "<button/>" ).insertAfter( this.element );
           
            // Configure the button by adding our widget class,
            // setting some default text, default icons, and such.
            // The create event handler removes the title attribute,
            // because we don't need it.
            w.button.addClass( "ui-checkbox" )
                       .text( "checkbox" )
                       .button({
                           text: false,
                           icons: {
                               primary: "ui-icon-blank"
                           }
                       });
           
            // Listen for click events on the button we just inserted and
            // toggle the checked state of our hidden checkbox.
            w.button.on('click', function( e ) {
                    w.element.prop( "checked", !w.element.is( ":checked" ) );
                    w.refresh();
                });

            // Update the checked state of the button, depending on the
            // initial checked state of the checkbox.
            w.refresh();
           
        },
       
        _destroy: function() {
           
            // Standard widget cleanup.
            //this._super();
           
            // Display the HTML checkbox and remove the button.
            w.element.removeClass( "ui-helper-hidden-accessible" );
            w.button.button( "destroy" ).remove();
       
        },
       
        refresh: function() {
            // Set the button icon based on the state of the checkbox.
            this.button.button( "option", "icons", {
                primary: this.element.is( ":checked" ) ?
                "ui-icon-check" : "ui-icon-blank"
            });

        }
   
    });
   
    // Create three checkbox instances.
    $(function() {
        $( "input[type='checkbox']" ).checkbox();
        $("button.ui-checkbox").removeAttr("title");
    });
   
})( jQuery );
0
 
PanosAuthor Commented:
Hi expert JonNorman
Thank you for your help. Code is working fine
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.