Deej
Deej

Reputation: 5352

Render Jquery dialog

I have the following:

application.js

   //= require jquery
    //= require jquery_ujs
    //= require_tree .
    //
    //= require jquery-ui
    //= require jquery-ui-1.8.14.custom.min
    //= require datatable
    //= require highcharts
    //= require exporting
    //= require turbolinks


$('table').on('click', 'td', function(e) {

    $('.create_booking').dialog('open');
});

What I am trying to do is make my <td> elements open the Jquery-ui dialog and render the partial booking_dialog it is not doing that for reason I do not seem to understand. The above should work.

Upvotes: 0

Views: 331

Answers (1)

ThiefMaster
ThiefMaster

Reputation: 318488

You need to create the dialog first:

$('.create_booking').dialog({
    autoOpen: false
});

After that you can use $('.create_booking').dialog('open') to show it. Also consider using an ID instead of a class for your dialog element. You only have one anyway, don't you?

Demo: http://jsfiddle.net/ThiefMaster/uJUuW/ (try clicking "open" first)

Upvotes: 1

Related Questions