<apex:page controller="MyController" sidebar="false">
<apex:form >
<apex:inputText size="36" value="{!Str}"/>
<apex:commandButton onClick="alert('{!Str}');" value="Alert"/>
</apex:form>
The code is just to pop out an alert window to display the input. However, it seems not a possible to do so with Salesforce apex since it's a server-side language. Am I correct ?
Fou new value of str you nead select it by javaScript or jQuery.
apex:inputText styleClass="str" value="{!Str}"
'alert($('.str').value())'