Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom code not working after switching tabs

RamanMinhas
Collaborator II

Hi guys,

 

what could be wrong in below code. Custom code work fine on view and edit mode but does not work when click on non default tab and returning to default tab.

 

<html>

<body>
<script type="text/javascript">
var id = document.getElementById("master_DefaultContent_rts_tsxxxx_sxxxx_fxxxxxc").innerHTML;
</script>

<div > &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;Related ID :
<a class="ContentURL" href="javascript:$pbC(id+'|xxx|xx|xxxxx|')" contentid="id">

<script>
document.write(id);
</script></a>

</div>
</body>
</html>

1 REPLY 1

Ilya_Khen
Champion III

Raman Minhas,

 

When switching the tab, the elements on the previous tab are kinda "destroyed" for JQuery point of view.

1. You need top place your custom object out of ANY tab.

2. Use Sys.Application.add_load(function(){ ... }); to execute your code, if you need it to work per load/reload.

3. Put element you are accessing in the code out of the tab.