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

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:


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


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





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


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)