Thanks Wizz,

I'll try that out too.

On Apr 22, 9:13 am, Wizz <[EMAIL PROTECTED]> wrote:
> And just to point something out... Duplicate id's are never good on a
> page... I think you're better off by setting either the 'name' or the
> 'class' attribute of the hidden input.
>
> A page will never pass validation if it has duplicate id's on it and
> some of your javascript my freak out.
>
> Greetz,
>
> Wizz
>
> On Apr 22, 1:44 pm, binro01 <[EMAIL PROTECTED]> wrote:
>
>
>
> > Thanks Shawn! This explanation of (this) helped me a great deal! And
> > helped my application!
>
> > Rob
>
> > On Apr 22, 5:33 am, Shawn <[EMAIL PROTECTED]> wrote:
>
> > > I *think* you are after something like this:
>
> > > <script type="text/javascript">
> > >         $(".stripeMe tr").click(function() {
> > >           var MyVal = $("#LNAME", this).val();
> > >           javascript:location.href='test.html&Myval=' + MyVal;
> > >         });
> > > </script>
>
> > > having a line that says $this(); doesn't really do anything, if it
> > > doesn't outright cause an error.
>
> > > "this" in JavaScript is always context sensitive and normally refers to
> > > the object that triggered an event, or the call to the function.  (this
> > > is a gross simplification, but....).  With that in mind, each time your
> > > click function gets executed, "this" will refer to the ".stripeMe tr"
> > > object that initiated the click.
>
> > > Now, there are a bunch of ways to use "this".  And for what you are
> > > after, there are a number of different approaches.  The sample I
> > > provided above says "find all objects with an id of #LNAME relative to
> > > the 'this' object".  In terms of the DOM, only objects that are a child,
> > > or grandchild of the object represented by 'this' will be found (if any).
>
> > > You could change this to avoid the context bit with something like
>
> > > $(this).find("#LNAME").val()
>
> > > Whatever works best for you, and that you understand.
>
> > > Hope that helps.
>
> > > Shawn
>
> > > binro01 wrote:
> > > > I been going through JQuery to add it to my knowledge base so I can
> > > > integrate some of its functionality to our new web 2.0 UI for our
> > > > applications which use to reside in RPG on IBM system i.
>
> > > > I have created is a "zebra" list that I want to click on the list to
> > > > help build the next page. There is a hidden element in the <tr> that
> > > > is highlighted that I need the value of to build the URL for the next
> > > > page. Im trying to use a this() that is then chained to get the value
> > > > of that element, but Im having no luck. Any help will be appreciated.
>
> > > > my jQuery looks like:
> > > > <script type="text/javascript">
> > > >       $(document).ready(function(){
> > > >    $(".stripeMe tr").click(function() {
> > > >      $this();
> > > >      var MyVal = $("#LNAME").val();
> > > >      javascript:location.href='test.html&Myval=' + MyVal;
> > > >    });
> > > >    $(".stripeMe tr").mouseover(function() {$
> > > > (this).addClass("over");}).mouseout(function() {$
> > > > (this).removeClass("over");});
> > > >            $('.stripeMe tr:even').addClass('alt');
> > > >       });
> > > > </script>
>
> > > > The HTML Looks like:
>
> > > > <table>
> > > >    <thead>
>
> > > >            <tr>
> > > >                    <th>Lorem</th>
> > > >                    <th>Ipsum</th>
> > > >                    <th>Dolor</th>
> > > >                    <th>Sit</th>
> > > >                    <th>Amet</th>
>
> > > >            </tr>
> > > >    </thead>
> > > >    <tbody class="stripeMe">
> > > >            <tr>
> > > >                    <td>Lorem</td>
> > > >                    <td>Ipsum<input type="hidden" id="LNAME" 
> > > > value="Ipsum1"></td>
> > > >                    <td>Dolor</td>
>
> > > >                    <td>Sit</td>
> > > >                    <td>Amet</td>
> > > >            </tr>
> > > >            <tr> ... So On and so forth with the same format as above
>
> > > > Once again, once the user clicks a row <tr> I need to get the LNAME
> > > > hidden element's value to build the URL that I will redirect the user
> > > > to.
>
> > > > Thanks in advance!
>
> > > > Rob- Hide quoted text -
>
> - Show quoted text -

Reply via email to