And one other thought. If your code posted accurately reflects the id's of
the items you can replace this:

 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;

with this:

var new_row_id = $('#new_' + row_id).val();

In both cases id is going to evaluate to: "new_row_1_4_2009_abc" so all you
need to do is prepend "new_".


On Sun, Mar 13, 2011 at 1:48 PM, Michael Grant <mgr...@modus.bz> wrote:

> $(".rowclick") is completely acceptable. It will just add the function to
> all elements with that class name, which I assume is that the OP is looking
> for.
>
> OP: In the code you pasted what part isn't working exactly? All you are
> doing is setting some variables. I don't see in the code where any actually
> does anything other than populate variables which are all var'd to the
> function, they aren't global. Also, can you confirm that there is an element
> with the id of  "new_row_1_4_2009_abc" and a parameter called "value"?
>
> I guess it might help if we knew what exactly you were trying to accomplish
> in order to determine if it's working or not.
>
> On a side note, since you are using jQuery I'd recommend the jQuery
> $("#idname").val() instead of document.getElementById("idname").value.
>
>
> On Sun, Mar 13, 2011 at 12:17 PM, Russ Michaels <r...@michaels.me.uk>wrote:
>
>>
>> it looks like you are using the classname instead of the object ID.
>> normally the $() function is fer getting a reference to a obejct by its
>> ID.
>>
>> $(".rowclick")
>> shouldn't this be
>> $("row_1_4_2009_abc")
>>
>>
>>
>>
>> On Sun, Mar 13, 2011 at 3:29 PM, Jake Churchill <reyna...@gmail.com>
>> wrote:
>>
>> >
>> > Look into jQuery's .each() method.  It helps in loopin over things like
>> > that
>> >
>> > -Jake
>> >
>> > Sent from my Droid
>> > On Mar 13, 2011 9:51 AM, "fun and learning" <funandlrnn...@gmail.com>
>> > 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:342964
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to