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);

                }

        );

THIS IS THE HTML

<table id="canvas" border="1">

        <thead>

                <tr>
                        <th id="1">was</th>
                        <th id ="2" class="add_item">First item to compare</th>
                </tr>
        </thead>

        <tbody>
                <tr class="add_attr">
                        <td> <input type="text" value="" disabled="true"></td>
                </tr>
        </tbody>


</table>


</div>
<span id="assets" style="display:none;">
        <input id="input_item" type="text" />
        <span id="attribute">
                <input id="name" type="text" />
                <select>
                        <option>text</option>
                        <option>number</option>
                        <option>time</option>
                        <option>true/false</option>
                        <option>video</option>

                </select>
        </span>
</span>

on clicking:
The first method works as advertised.
the second method gives me undefined
the third method gives me undefined and will throw an error on
elem.addClass() , the error is "t has no properties"
Am I missing something?

Reply via email to