First bit is easy:

// All spans with class="info"
var infoSpans = $('span.info');

Second bit depends on how you have structured your HTML. Assuming the
following HTML:

<span class="info email-info">Text.....</span>
<input class="hasInfo" type="text" ...>

Script (untested):

$(function() {
  $('input.hasInfo').click( function() {
    var infoSpan = $(this).prev('span.info');

    // do whatever with the span

    // show it
    infoSpan.show();

    // test if it's a particular class
    if ( infoSpan.is('.email-info') ) {
      // do something
    }
  });
});

Karl Rudd

On 2/27/07, Timothy Bowler <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
> I am creating tooltips for a form. The text that appears in the tooltip will
> have two classes:
>
> <span class="info email-info">Text.....</span><span class="info
> password-info">Text.....</span>
>
> First how can I access all the elements that contain 'info' in their class?
> Secondly when the user clicks on the input box i need to access the second
> class so i know which one it is, how can I do that?
>
>
> Thank you in advance
>
> Tim
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>
>

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to