Due to a bug on the application I am attempting to strip leading and trailing whitespace from any input. It is a ruby on rails application however I am not sure what approach to take. The main point is not how to achieve this but rather which is the better approach to take in terms of efficiency etc.
JQuery
With JQuery I can just add the following:
$("input, select").change(function()
{
this.value=$(this).val().trim();
});
With Ruby I can always use strip. What would the best approach be? I believe JQuery as its simple and effective however I default to JQuery generally as my knowledge of Ruby Rails is limited.