+ Start a Discussion
ksmoksmo 

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">
                            UPDATE
                        </div>

<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=""  />                                                                                                                       
</apex:actionFunction>

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(){
j$('#cockpitUpdateButton').click(function(){
update(companyname);
});
}

On the system debug statemnet I am getting only null
VivekShindeVivekShinde
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.