hide link image if the link itself is using jquery?

there is a link and right next to it is a link image embedded. Like 'driving direction + car image"' if there is no 'driving direction' text for link, hide the care image icon embedded.. How do you do that in jquery?? please someone?

<span class="website">
<a href="http://www.google.com">Visit My Website</a>
</span> 
<img class="websiteimage" src="/Style Library/Images/design/icons/icon-www.png" alt="WebSite" />

so basically check if a tag has any text in it and if its empty hide the img tag embedded pic

Answers


No idea if this works, but here's what I would try:

$('img').each(function() {
  if ($(this).prev('span.website').find('a').text() == '') {
    $(this).hide();
  }
});

Need Your Help

Spring Data Neo4j template.fetch() leading to OutOfMemory?

neo4j spring-data-neo4j

Is there a theoretical possibility that using template.fetch() could lead to OutOfMemoryException? Let's say for example that there is a loop that loops 100 times and each time template.fetch() is

Full Build, Incremental Build and Deploy within Powerbuilder

deployment build powerbuilder powerbuilder-build-deploy

What is the difference between a Full Build, an Incremental Build and Deploy within Powerbuilder? The only difference I can see is that Deploy allows you to update the PBDs for, well, deployment.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.