Get values from multipy inputs for search field

Get values from multipy inputs for search field

Hi.
Kindly asking for help.


There is one search field, several checkboxes and several inputs (they are for numbers).

As result I need to make search query something like this: OperaName alto:1 bass:2
So the
1. "OperaName" i should type myself in search field.
2. alto (name of checkbox) should be pushed to search field with the number that I type in input with class qty.

If qty field is set, than alto:1 should be appended to the main keyword query .
If I uncheck Alto checkbox than it should be removed from search field.

I have some jQuery code (see it on jsfiddle please) but it reset my keyword for search and I don't know how to get value from qty field and put it in format alto:1 or bass:2. Also there is a problem with how I can remove alto:1 when checkbox becomes unchecked.

Please help to solve.
Thanks in advance.