function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NareshKrishnaNareshKrishna 

Javascript not working properly in apex:outputlink

Hi All,

 

There is an output link on one page.

When I click on that, it should change style of component to display:none on same page.

For that i have created a javascript function and it is working fine but after chaging the style it simply refresh the page

as I didnt specify value to navigate page.

 

Below is my logic:

 

<apex:page>
<script>
function fnCheck(input)
{
    alert("script");
    document.getElementById(input).style.display = "none";
}
</script>
<apex:form>
<apex:outputLink onclick="fnCheck('{!$Component.testId}');">Test</apex:outputLink>
<apex:inputText id="testId"/>
</apex:form>
</apex:page>

 

Is there is any way to specify empty value in outputLink or any way to do this?

 

Thanks.

 

SrikanthKuruvaSrikanthKuruva

try using the html anchor tag instead of the apex:outputLink tag.

Sam27Sam27

try using javascript&colon;; in place of value in outputlink tag

 

<apex:outputLink onclick="fnCheck('{!$Component.testId}');" value="javascript&colon;;">Test</apex:outputLink>

 

I think that will solve ur problem

 (note &colon; is html encoding of the colon value)

Sam