Q:

datatables get name of input from row on click in callback?

I have datatables setup as well as bootstrap select, a plugin which turns checkboxes into on/off switches. When the switch is toggled i'm trying to get the name of the input which is an ID.
This is my code and a live jsfiddle when I click the switch the alert is undefined. How can I get the input name(123) to alert? And more information on the boostrap plugin here http://www.bootstrap-switch.org/
Thanks
testdata = [{
    "id": "<input name\"123\" id=\"create-switch\" type=\"checkbox\">",
    "country_code": "UK",
    "title": "Legal Director",
    "pubdate": "2012-03-08 00:00:00",
    "url": "http://..."
}, {
    "id": "59",
    "country_code": "UK",
    "title": "Solutions Architect,",
    "pubdate": "2012-02-23 00:00:00",
    "url": "http://..."
}];

$('#test').dataTable({
    "aaData": testdata,
        "aoColumns": [{
        "mDataProp": "id"
    }, {
        "mDataProp": "country_code"
    }, {
        "mDataProp": "title"
    }, {
        "mDataProp": "pubdate"
    }, {
        "mDataProp": "url"
    }],
        "fnCreatedRow": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
        $('#create-switch', nRow).wrap('<div class="make-switch switch-mini" />').parent().bootstrapSwitch();
    },
        "fnInitComplete": function () {
        alert("init");
        $('.make-switch').on('switch-change', function (e) {
            var postid = $('.make-switch input').attr('name');
            alert(postid);
        });
    }
});

A:

Try
testdata = [{
    "id": "<input name=\"123\" id=\"create-switch\" type=\"checkbox\">",
        "country_code": "UK",
        "title": "Legal Director",
        "pubdate": "2012-03-08 00:00:00",
        "url": "http://..."
}, {
    "id": "59",
        "country_code": "UK",
        "title": "Solutions Architect,",
        "pubdate": "2012-02-23 00:00:00",
        "url": "http://..."
}];

$('#test').dataTable({
    "aaData": testdata,
        "aoColumns": [{
        "mDataProp": "id"
    }, {
        "mDataProp": "country_code"
    }, {
        "mDataProp": "title"
    }, {
        "mDataProp": "pubdate"
    }, {
        "mDataProp": "url"
    }],
        "fnCreatedRow": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
        $('#create-switch', nRow).wrap('<div class="make-switch switch-mini" />').parent().bootstrapSwitch();
    },
        "fnInitComplete": function () {}
});

$('#test').on('switch-change', '.make-switch', function (e) {
    var postid = $(this).find('input').attr('name');
    console.log(postid);
});

Demo: Fiddle

