Created
April 13, 2012 01:08
-
-
Save ovaillancourt/2372523 to your computer and use it in GitHub Desktop.
I love javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Javascript magic here | |
//We grab the value from the dom element, split it in terms where every | |
//term is delimited by a comma, then trim every term, re-combine them | |
//together using a comma as separator and then URI encode the whole thing. | |
var fieldVals = encodeURIComponent( | |
this.$('#product_search #field_val').val().split(',').map(function(v){ | |
return v.trim(); | |
}).join(',') | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment