javascriptjquerytextbuttonswitchers

input text change onclick button value


Actually i want to create a page switcher, all i need for this is an input with type text where will be entered the number of the page, and i have the second input with type button and onclick value:

<input type="text" value="#number of the page#" />
<input type="button" onclick="_go_page_('cf_pages_form_name1','#number of the page#');" />

I cant figure it out how to take this #number of the page# and put it in onclick dynamically using javascript... please smb help!


Solution

  • <input type="text" id="txtPageNumber" value="2" />
    <input type="button" id="btn" value="click" onclick="_go_page_('cf_pages_form_name1','#number of the page#');" />
    
    
    $(document).ready(function(){
    
        $("#btn").click(function(){
    
           var $val = $("#txtPageNumber").val();
            alert($val);
                _go_page_('cf_pages_form_name1',$val);
    
        });
    
    
    });
    
    
    
    
    });