My code in JSP file looks like this :
<s:form namespace="/user" action="list" method="POST" id="filterListForm" theme="simple"
onsubmit="document.getElementById('filterSearchText').value=document.getElementById('filterSearchText').value.replace(/\\/g,'')">
It won't replace the backslash char. I've tried the following, none of them work :
replace('/\\/g','')
replace(/\\\\/g,'')
replace(\/\\\/g,'')
But if I change it to the following, it works :
<s:form namespace="/user" action="list" method="POST" id="filterListForm" theme="simple"
onsubmit="replaceBackslash()">
<script type="text/javascript">
function replaceBackslash() { document.getElementById('filterSearchText').value=document.getElementById('filterSearchText').value.replace(/\\/g,''); }
</script>
Why ? Is there a way to make it work in the first case ?