Select value in an if statement - jquery

Select value in an if statement - jquery

Hi

I'm populating a dropdown using JSON data

  1. function(dta){ $.each(dta, function(index, item) { //some other inputfield values are updated here... $("#unservices option[value="+item.service_id+"]").prop('selected', true); } });
how do I write an if statement for $("#unservices:) ?

  1. if($( '#unservices' ).val() == '1'){ alert($( '#unservices' ).val()) }};
My problem is that $( '#unservices' ) .val()) always is equal to "1"?

Thank You .