[jQuery] livequery $(this) is null?

[jQuery] livequery $(this) is null?


jQuery.create_table.prepare_add_item=function()
{
    var items=$('#canvas > thead > tr > th');
    var prev_value='';
    var input_item=$('#input_item');
    var head=$('#canvas > thead > tr');
// FIRST METHOD
    $('#canvas > thead > tr > th').click(
        function()
        {
            alert($(this).attr('id'));
        }
    );
///SECOND METHOD
    $('#canvas > thead > tr > th').livequery(
            function()
            {
                $(this).click(function(){
                    alert($(this).attr('id'));
                })
            }
    );
    //THIRD METHOD
    $('#canvas > thead > tr > th').livequery('click',
        function(event)
        {
            var elem=$(this);
            alert(elem.attr('class'));
            if (elem.is('.manipulated'))return;
            elem.addClass('manipulated');//add class that it is being
manipulated
            prev_value=elem.html();//store whatever it's in here before
        //    alert(elem.id);
            elem.empty();
            elem.append(input_item);
        }
    );





































    • Topic Participants

    • admin