I have to pass HTML input text value to apex controller. I am working, when checkbox is checked it value passes to the input text. Like, when a field of type checkbox 'Apple' is checked Apple pass to the html text field. This value(Apple) i need to pass in apex Controller. I can not use apex:inputtext, because i am not getting value in this. I have to use input type="text".Below is my code Please help!
<script type="text/javascript">
function copyMe(checkbox) {
if(checkbox.checked){
//alert('####' +txt);
var textVal = document.getElementById('txt').value;
var newVal;
if(textVal == ''){
newVal = checkbox.value;
} else {
newVal = textVal + ', ' + checkbox.value;
}
document.getElementById('txt').value = newVal;
}
}
</script>
<input type="checkbox" class="chb" value="Apple" onClick="copyMe(this);"/>Apple
<input type="text" value="{!Description}" id="txt"/>