Alexgr79
Alexgr79

Reputation: 80

JQuery selectable cell

I have a problem with the following code:

http://jsfiddle.net/54Dd9/

$('#dynamictable').append('<table id="selectable"></table>');
var table = $('#dynamictable').children();    
table.append("<tr><td>a</td><td>b</td></tr>");
table.append("<tr><td>c</td><td>d</td></tr>");

$("#selectable").selectable({
                filter: "td",
                selecting: function(event, ui) {
                    console.log($(ui.selecting).prevAll().length);   
                }
            });

I need to select the row and the columns.

Can you help me?

Upvotes: 1

Views: 1410

Answers (2)

jomon
jomon

Reputation: 112

is that required to append table with script? if its not then u can use this way,

`http://jsfiddle.net/54Dd9/1/`

you have to use jquery ui to use selectable function

http://jsfiddle.net/54Dd9/3/

Upvotes: 1

Sjoerd de Wit
Sjoerd de Wit

Reputation: 2413

 $('#identifier').selectable({ });

is not part of the jquery core library,

You need to include the jQuery UI library which has this functionality http://jqueryui.com/

Updated your fiddle to a working example

http://jsfiddle.net/54Dd9/2/

Upvotes: 0

Related Questions