Trouble getting Auto-complete to toggle checkboxes

Trouble getting Auto-complete to toggle checkboxes

Good morning all!
  I've been looking through all the documentation that I can find and have turned to forums as a last resort for this little qualm I'm having with auto-complete and toggling check boxes.  So thank you in advance for your help!

I am trying to use the jquery ui auto-complete widget to allow users to type in input, then based on their input to alter the state of a check box on the page.

Eg. I have a checkbox

input type="checkbox" name="dog" 

then I have an auto complete box who has a value in the list of "dog" which is loaded by building an 
array from an external yml file.

I've the following select: function for the auto-complete widget.

select: function(event, ui) {
       user_animals.push(ui.item.value); //also simultaneously building an array
      $("input[name|=jQuery.trim(ui.item.value)]").attr('checked', 'checked');
      $("p.bottom").append(jQuery.trim(ui.item.value) + "<br />"); //appending their input to the bottom of a list
      ui.item.value = ""; //clears the auto-complete input box so the user can enter the next animal
      $(#ing_input").autocomplete("close"); //closes the drop down to restart the sequence
}

the problem is with the checking the input box with the name|=jQuery.trim(ui.item.value)
if I change it to 
$("input[name|='dog']").attr('checked', 'checked');
it works fine... for just the dog input... however entering "cat" now checks... "dog"'s check box... 
any idea on why this is happening and how to fix it?
Thanks,
-TimmyTwoToes

PS. I did try setting the ui.item.value to another variable and then putting the variable there... I've also added the jQuery.trim() in order to remove any sort of breaklines or spaces that could have been messing things up. the check boxes are built via a ruby script (i'm using sinatra) in an erb file, checking the checkboxes attributes shows the "name" value to be correct... eg no leading or trailing spaces or breaks.