There is such code:

$('.block_ch').click( function() { var attribute = $(this).attr('id'); alert(attribute); } ); 

But by pressing silence. Where can there be a mistake? The function is in $(document).ready along with the other working functions .click

    1 answer 1

    If the element is generated and not immediately in the html code, you need to use .on

     $(document).on('click', '.class', function () { }); 

    You have it, respectively:

     $(document).on('click', '.block_ch', function () { var attribute = $(this).attr('id'); alert(attribute); } ); 
    • always use .on('click'); , to simulate a click .click(); : 3 - CbIPoK2513 1:24 pm