This topic contains 1 reply, has 2 voices, and was last updated by Sean Sean 2 years, 11 months ago.

Problem with checkbox in datable


  • turkyl
    Participant

    Member Reply #598

    I’m having a problem with a checkbox in a table. When I try to read the state, I get the following message:

    Uncaught TypeError: Cannot read property ‘checked’ of undefined

    I have an example of the problem in the following page:

    http://importaciondeproductos.com/manager/productos.asp

    At the bottom of the table, when you click the green button “Activar Productos” there should appear a javascript alert with the state of the checkbox placed on the same row, left column (chekcbox name: todos). But it throws the error. If I change the type “checkbox” for “text” and I try to get the value, it works.

    I guess there’s a plugin or js missing, but I’ve tried everyhting without success…

    Can you help me?

    Sean
    Sean
    Keymaster

    Posts: 4226
    Support Staff Reply #605

    Hi :),

    You should use jquery way to access to the input’s state:

    onclick=”alert($(‘#todos’).is(‘:checked’));”

    For more info please check jquery’s official documentation here: https://jquery.com/

    Thanks.

    • This reply was modified 2 years, 11 months ago by Sean Sean.

You must be logged in to reply to this topic.