You need to sign in to do that
Don't have an account?
Anna Lu 6
using javascript within <script> tag
I want to insert a value generated from javascript to visualforce page, but it does not work. Here's my sample code (my real task is to do some calculation in <script>, so I simply cannot tape in apex tag directly):
Could anyone help?
I know a lot answers are using javascript as a static file... but I still want to use it here within this page.
Thank you!
<apex:page controller="CAReportAvgFine" > <apex:sectionheader title="Compliance Advisory Report" subtitle="Saved Penalty"/> <apex:outputText id="fine"> 76534</apex:outputText> <script> document.getElementByID("{!$Component.fine}").innerHTML= "8965478" ; </script> <style></style> </apex:page>
Could anyone help?
I know a lot answers are using javascript as a static file... but I still want to use it here within this page.
Thank you!
Try Below snippet: Its working, I have verified.
Please like the answer and mark it best if this helps.
Thanks,
Aman
1) you wrote 'getElementByID' instead of 'getElementById'.
2) you did not pass value in value attribute.
Just taking a follow-up. Is your issue resolved.
If yes, Please like the answer and mark it as best.
Thanks,
Aman