Skip to content
Advertisement

How to hide the whole span if there is no file in “href” direction

I have problem with hiding empty links.. please can someone help me.:

JavaScript

if "href="/sunsetplanlama/<?php echo $sonuc['proje_ismi'] ?>/kumas_1.png" going no where than I want the hide "K1" letter..

how can I do that?

Advertisement

Answer

A few points to consider:

  • Server-side solutions are inappropriate: You want to test for resource availability at the client and that can only be achieved with the client being the agent.
  • Checking for resources may take time, in particular more time than is needed to render the html at the client. Removing visible markup ( eg. the span element of the example ) contingent on failure in retrieving resources may result in rendered material showing up briefly and disappearing again when the intent is not to show it at all. So the better strategy is to hide it by default and present it as soon as the resource availability has been ascertained.

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement