0

Code:

In Jquery dialog,

$('#status-dialog')
                .dialog({
                    hide: 'fade',
                    autoOpen: false,
                    resizable: true,
                    title: 'Status',
                    modal: false
                });

Index.cshtml

<div class ="cb-status">
    <input id="accept-cb-name" type="checkbox"/>
    By Name<br /><br />
</div>

How to display the checkbox on the jquery dialog title("Status") bar?

2
  • I don't think there is buitin function for this. The best way to create it is to edit the DOM using inspector or firebug (add the input) and then use jquery code to append input to the right place.
    – jcubic
    Jul 5, 2013 at 5:56
  • Can you post a sample example of how to accompolish this task, Thanks.
    – Earth
    Jul 5, 2013 at 5:58

1 Answer 1

1

Check here DEMO http://jsfiddle.net/yeyene/GnpQ8/7/

$(document).ready(function(){
    $("#dialog-model").dialog({
        create: function (event, ui) {
            $(".ui-dialog-title").html('<input id="accept-cb-name" type="checkbox"/> By Name');
        },
        width: 250,
        height: 150,       
        modal: true,
        resizable: false
    });
    // checkbox event
    $(document).on('click','.ui-dialog-title input', function(){
        alert('Bang !!');
    });
}); 
4
  • How to write click event for the checkbox here?
    – Earth
    Jul 5, 2013 at 7:13
  • One doubt, that is if there are two checkboxes and how to check (using class or anything) whether particular checkbox has been checked inside the click event
    – Earth
    Jul 5, 2013 at 8:55
  • check this demo, click red check button and see...jsfiddle.net/yeyene/GnpQ8/8
    – yeyene
    Jul 5, 2013 at 9:19
  • first check one or both checkboxes, then click the button and see the checked checkbox value.
    – yeyene
    Jul 5, 2013 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.