How to add <div title="test"></div> like property for jquery-ui dialog buttons

11,977

Solution 1

I don't think there is any option to apply title attribute for buttons of jquery dialog.Here is the solution I am using as of now.

open: function(event, ui) {
      //  In dialog open
        $('.ui-dialog-buttonset button:first').attr('title','Ok');
        $('.ui-dialog-buttonset button:last').attr('title','Cancel');
    }

Solution 2

Put the title attribute in your HTML markup that you're applying the dialog to.

<div title="I show on hover!">...</div>
...
$('div').dialog(...);

Solution 3

the attribute title is what you are looking for. http://www.quackit.com/html/tags/html_button_tag.cfm

Share:
11,977
sandy
Author by

sandy

Under construction

Updated on July 18, 2022

Comments

  • sandy
    sandy almost 2 years

    Is there any attribute in dialog of jquery-ui which can provide behavior like title property of div.(Showing title name on hover)?

    Below is generated html of OK button of confirm dialog box.I want 'title' like property of div to be applied for 'OK' and 'Cancel' button

    <button type="button" class="ui-button 
            ui-widget 
            ui-state-default 
            ui-corner-all 
            ui-button-text-only"   role="button" aria-disabled="false">
         <span class="ui-button-text">Ok</span> </button>
    

    EDIT: Here are some property whihc I used for dialog

     dialog({
    
            height:110,
            widht:460,
            title:"This is dialog Title",
            modal: true,
    
            buttons: {
            "Ok": function() {  
            $( this ).dialog( 'destroy');
            },
            Cancel: function() {
                $( this ).dialog( 'destroy');
            }
            },
    

    enter image description here

  • sandy
    sandy over 11 years
    Indeed,but not 'dialogTitle'.Title for 'OK' and 'Cancel' button
  • SeinopSys
    SeinopSys over 11 years
    @sandy Add the attribute to the button? It can be added to any element basically.
  • roman-roman
    roman-roman over 11 years
    sorry, do not understand: title does not work for the dialog?
  • sandy
    sandy over 11 years
    Edited question,hope its understandable now.