Is it possible that the click event is actually happening on the TD 
elements and not the TR?  You might try attaching the click event to the 
parent table (so it only binds to one element) and take advantage of 
event bubbling.  Use the event.target attribute to get to the row:

$("#mytable").click(function(event) {
     var $target = event.target;
     if ( $target.is("td") ) {
         row_id = $target.parent().attr("id");
         } else if ( $target.is("tr") ) {
         row_id = $target.attr("id");
         }
         ....rest of your code here....
});

HTH,
Carl

On 3/13/2011 7:43 AM, fun and learning wrote:
> Hi All - I am trying to get the following working. It seemed to work 
> initially, but somehow it stopped working
>
> I have a row like below
>
> <tr id="row_1_4_2009_abc" class="rowclick">
>     <td></td>
> </tr>
>
> I am using jquery to get the id on click of a row:
>
> $(".rowclick").click(function() {
>    var row_id = $(this).attr("id");
>    var getAttributes = row_id.split("_");
>    var setCommonAttr = getAttributes[1] + "_" + getAttributes[2] + "_" + 
> getAttributes[3] + "_" + getAttributes[4];
>    var new_row_id = document.getElementById("new_row_" + setCommonAttr).value;
> });
>
> Can anyone let me know what is wrong with the above code. Tried different 
> options but with no success
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343008
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to