Hi There,

If I am not mistaken, 'contains' is a selector not a method.

http://docs.jquery.com/Selectors/contains

You could try with the following:

$("span.total:contains('1)").parent().hide();

OR, if you decide to place it in If-else block, then do the following:

if ($("span.total:contains('1')").length > 0 ) {
  $('div.header').hide();
}

// $("span.total:contains('1')") matches all elements containing '1',
so would you have to use length to check the number of matched element
is more than 0


Hope it helps,

Thanks,
Abdullah.


On Apr 4, 2:10 am, marprus <marcel.pru...@gmail.com> wrote:
> I have html generated by php (several html codes like below):
>
> <div class="header">
>     <a href="node/188?slide=3" class="previous">   Previous    </a>
>      |        Image    <span class="current">   1    </span> of
>
>     <span class="total">   1    </span>     |
>
>     <a href="node/188?slide=2" class="next">    Next
>     </a>
>   </div>
>
> What i need to do is to hide "header" div if span class "total"
> contains number 1. (like it is in above example)  I tried code
> something like this but no success:
>
>   $(document).ready(function() {
>     if ($('.total').contains("1") {
>         $('div.header').hide();
>         })
>    });

Reply via email to