Execute function on input change

Execute function on input change

Hello,

I have a select form with id=px

I want to make the select execute a function every time an option is selected. I took the Change function and my code looks like this:

 $("#px").change(function () {
var str = "";
$("#px option:selected").each(function () {
str += $(this).text() + " ";
});
// $("div").text(str); - this line is changed with my function





            $('#selectable1 span.cica').css('font-size', str + "px");
})
.change();


It looks that srt variable is not working with my .css function. What is wrong?

My markup is:

         <select id="px">
            <option class="option" value="8" label="8">8</option>
            <option class="option" value="9" label="9">9</option>
            <option class="option" value="10" label="10">10</option>
            <option class="option" value="11" label="11">11</option>
            <option class="option" value="12" label="12">12</option>
            <option class="option" value="14" label="14">14</option>
            <option class="option" value="18" label="18">18</option>
            <option class="option" value="21" label="21">21</option>
            <option class="option" value="24" label="24">24</option>
            <option class="option" value="36" label="36">36</option>
            <option class="option" value="48" label="48">48</option>
            <option class="option" value="60" label="60">60</option>
            <option class="option" value="72" label="72">72</option>
        </select>













Thank you!