You need to sign in to do that
Don't have an account?

How to get the values to pass form inputtext to javascript
<apex:pageblock id="pb1">
<apex:pageblockSection id="pbs1">
<apex:inputCheckbox id="checkbox1" label="Check Me" onclick="getCheckBoxValue();"></apex:inputCheckbox>
<apex:inputtext id="textbox1" label="Name" onchange="gettexBoxValue();"/>
</apex:pageblockSection>
</apex:pageblock>
<script language="javascript">
function getCheckBoxValue()
{
alert(document.getElementById('{!$Component.frm1.pb1.pbs1.checkbox1}').checked);
}
function gettexBoxValue()
{
var a=document.getElementById('{!$Component.frm1.pb1.pbs1.textbox1}');
alert(a);
}
//if iam using this iam getting.
function CopySubject() {
var CaseSub= $('[id$=textbox1]').val();
alert(CaseSub);
}
</script>
<apex:pageblockSection id="pbs1">
<apex:inputCheckbox id="checkbox1" label="Check Me" onclick="getCheckBoxValue();"></apex:inputCheckbox>
<apex:inputtext id="textbox1" label="Name" onchange="gettexBoxValue();"/>
</apex:pageblockSection>
</apex:pageblock>
<script language="javascript">
function getCheckBoxValue()
{
alert(document.getElementById('{!$Component.frm1.pb1.pbs1.checkbox1}').checked);
}
function gettexBoxValue()
{
var a=document.getElementById('{!$Component.frm1.pb1.pbs1.textbox1}');
alert(a);
}
//if iam using this iam getting.
function CopySubject() {
var CaseSub= $('[id$=textbox1]').val();
alert(CaseSub);
}
</script>
You can use class attribute instead of Id to get the value.
<apex:inputtext styleClass="textbox1" label="Name" onchange="gettexBoxValue();"/>
In the JS you use:
document.getElementsByClassName('textbox1')[0].value
Thanks