Not displaying an image field if image not selected


i have web app has image field may or may not have photo selected. trying hide div element includes photo if photo not present.

 

i found jquery code supposed achieve me can't work.

 

my div in detailed web app layout is

<div class="phto">

{tag_photo}

</div>

 

at end of layout have following code

<script type="text/javascript">

//<![cdata[

if ($('.phto').is(":empty")){

$('.phto').hide();

}

//]]>

</script>

 

however div remain viewable - see example of app item no image @ http://panelfab.com.au/product-profile/product-1 can see the  description still indented div hold photo. don't want want div act same display: none condition.

 

am using correct code or have overlooked something?

try updating jquery library. saw  you're using 1.2.3 , current version 1.7.2.

 

also, got error:

typeerror: document.getelementbyid("loginp") null (line 931.) 

 

 

also, either browser's crazy or left html firebug console @ bottom.

 

also, try taking jquery out of cdata block (which afaik unnecessary) , adding inside document ready statement like

 

 

 

<script type="text/javascript">

$(document).ready(function(){ stuff

});

</script>

 

 

 

so code won't run until entire document loaded (and until elements want effect there.)



More discussions in Web Apps


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support