Hey guys,

i'm having a hard time with jquery right now.

Imagine the following simple table:

CODE:

         <table border='1' id='list_tracks_table'>
            <colgroup>
              <col width='40%' />
              <col width='20%' />
              <col width='20%' />
              <col width='20%' />
              <col width='0%' />
            </colgroup>

            <thead>
              <tr>
                <th>Title</th>
                <th>
                  Genre
                </th>
                <th>
                  Speed
                </th>
                <th>
                  Length
                </th>
              </tr>
            </thead>
            <tbody>
              <tr>

                <td>
                  Cocktail Lounge
                </td>
                <td>
                  Chill
                </td>
                <td>
                  126
                </td>
                <td>

                  03:03
                </td>
                <td class='hidden_url_field_for_track_list'>
                  /mp3/stream/MM-MB-0030-COCKTAIL-LOUNGE-126BPM.mp3
................

As you can see, the last field of the row gets hidden via CSS.
Now i have defined an onclick-Handler for every row of the table like
this:

CODE:

        function addClickHandler(tableId)       {

                var tableObj = document.getElementById(tableId);
                var tBody = tableObj.getElementsByTagName('TBODY');
                if(tBody){
                        var rows = tBody[0].getElementsByTagName('TR');
                }else{
                        var rows = tableObj.getElementsByTagName('TR');
                }
                for(var no=0;no<rows.length;no++){
                        rows[no].onclick = clickOnTableRow
                }
        }

'clickOnTableRow' looks like this:

CODE:

        function clickOnTableRow()
        {
          alert ("working!")
       }

Now, clickOnTableRow() is working when i click on a table row (i can
see that because of the alert-box), but how can i now select the
contents of the last hidden field of this exact row?

I tried it like this:

CODE:
        function clickOnTableRow()
        {
                var foo = 
jQuery(this).('hidden_url_field_for_track_list').text();
                console.info("content: " + foo);
        }

but this gives me:

"content: undefined"

Then i tried:

        function clickOnTableRow()
        {
                var foo = jQuery('hidden_url_field_for_track_list').text();
                console.info("content: " + foo);
        }

but this gives me just:

"content:"

What am i doing wrong here?


But no

Reply via email to