Frederik Smith
Frederik Smith

Reputation: 1

Change text of DIV where Title equals

I am looking to do something like this: (Wont work..)

<script>
$(document).ready(
    $('a[title="Girls"] .ellipsis_text').text('test');
);

To change the span text with the class ellipsis_text from the following code:

<li><a href="http://www.site.com/girls" title="Girls"><span class="cls_truncate_text"><span class='ellipsis_text'>Girls</span></span></a></li>

Do anybody know how to do this?

Upvotes: 0

Views: 72

Answers (2)

Antonio Papa
Antonio Papa

Reputation: 1666

Try this:

$(document).ready(function(){
   $('a[title="Girls"]').find('.ellipsis_text').html('test');
});

Upvotes: 1

Ludovic Guillaume
Ludovic Guillaume

Reputation: 3287

You forgot function()

Try with

$(document).ready(function() {
    $('a[title="Girls"] .ellipsis_text').text('test');
});

Demo: http://jsfiddle.net/M25sx/

Upvotes: 1

Related Questions