187
rated 0 times
[
189]
[
2]
/ answers: 1 / hits: 34716
/ 10 Years ago, tue, may 6, 2014, 12:00:00
var $one = $('#oneClueShow');
var x = $(#clueOneInput).find('input[type=text]').val();
if(x == 'D R' || x == 'd r'|| x == 'D r'|| x == 'd R'|| x == 'd'|| x == 'r' || x == 'd R' || x == 'T A')
Above is a snippet of java/ I have. What it does is takes an input -- then checks for a match. The bug I'm looking to resolve is if there are spaces after or before it isn't recognized.
For example within the input someone can type 'D R' no problem. If a space is added like so 'D R ' then it no longer recognizes the input.
Is there something I can do to affect the input to ensure no space before/after prior to button click? I've been looking into replace, but can't seem to get it going.
A reference for what I've been looking at : http://www.w3schools.com/jsref/jsref_replace.asp
More From » jquery