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

how to pass values from vf page to apex on the click of a div element

Below is the code for update button and the text panel on the vf page

 <div id="UpdateButton">

<input id="textpaneljs" type="text" name="txt" size="35" value="{!myoutput}"/></div>   

I have written the below code on the vf page

<apex:actionFunction name="update" action="{!update}" rerender="">                                                                                                                                                                                              
<apex:param name="companyname" value=""  />                                                                                                                       

then on the apex class

public void update(){
        String CName = ApexPages.currentPage().getParameters().get('companyname');
        system.debug('the customized 123 are '+CName);        

then on jquery in static resource

var companyname = j$('#textpaneljs').val();
function setupClickEvents(){

On the system debug statemnet I am getting only null
You have used an incorrect id to bind the click event. Also, make sure that you are getting correct value in console log or alert statement of companyname javascript variable.