I'm trying to format the users input so that it can meet the conditions in my string comparison function, as you know with string comparison extra spaces, tabs, and "enter(newline)" are considered. So the idea is format the users input before running string comparison function. Currently extra spaces, tabs and the "enter(newline)" problem has been partially solved.
Here's my code and a fiddle: http://jsfiddle.net/eSE9Y/2/
html
<textarea id="address"></textarea>
<input type="button" id="Validate" value="Validate" onClick="valbtn()">
javascript
$(document).ready(function(){
$("#Validate").click(function () {
$('#address').val($('#address').val().replace(/\s+/g,' '));
});
});
But the problem is if a users first and ending input is enter or a space, it will still mess up the string comparison function, until I find the PHP trim, how can i utilize this php function to fit/solve the problem. Any suggestion/opinion is appreciated.