Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Identifying div by text

I have a generated page with code like this that I can't change:

<td class="ewTableHeader" style="white-space: nowrap; vertical-align: top;">
<div>CAT Hours</div>
</td>
<td class="ewTableHeader" style="white-space: nowrap; vertical-align: top;">
<div>Field Time</div>
</td>
There are eight columns set up this way. How can I use Tipped on the div's?
Is there a way to use the code below with that structure. I have used this on other pages where the element had an ID.
Tipped.create('SomehowIdentifyTheDiv', {
    ajax: {
        url:'ajaxTasKpi2018Headers.asp',
        type:'GET',
        data:{strColumnName:TheTextFromTheDiv},
        success:function(msg) {return msg;},
    },
    showOn: 'focus mouseover',
    behavior: 'mouse',
    skin: 'myrpts'
    });

Thanks for any help you can provide.
Scott

Comments

  • You can loop over the elements to get what you need.

    $('td.ewTableHeader > div').each(function(i, element) {
      Tipped.create(element, {
        ajax: {
            url:'ajaxTasKpi2018Headers.asp',
            type:'GET',
            data:{strColumnName:$(element).html()},
            success:function(msg) {return msg;},
        },
        showOn: 'focus mouseover',
        behavior: 'mouse',
        skin: 'myrpts'
        });
    });
    
  • Thanks. That worked.

Sign In or Register to comment.