jQuery - String variable being escaped?
<p>I have a fairly simple script designed to hide/unhide various form fields based on customer type. The code looks as follows:</p>

<pre><code>
var customerTypeFields = [];
    customerTypeFields['Individual'] = ['First Name(s)', 'Last Name', 'Date of Birth'];
    customerTypeFields['Limited Company'] = ['Name', 'Company Number'];
    customerTypeFields['Partnership'] = ['Name', 'Company Number'];

    $('#customer-type-selector').chosen().change( function() {
        var visibleFields = customerTypeFields[$(this).children("option[value='" + $(this).attr('value') + "']").text()];
        console.log(visibleFields);
        $.each(visibleFields, function(i, field) {
            $('#customer-features').find('input[data-feature-type=' + field + ']').parent().parent().show();
        });
    });
</code></pre>

<p>This appears to work to some extent, but I'm getting a strange error when loading an individual, which is:</p>

<pre><code>Uncaught Error: Syntax error, unrecognized expression: input[data-feature-type=First (s)] 
</code></pre>

<p>You will note that <code>First  (s)</code> is not in my array, and as such it seems like the word <code>Name</code> is being stripped - any idea why the string would be edited like that?</p>

<p>Thanks!</p>
