+ 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.