I try to create a function, I pass a selector plus the value and I would like to get text
function getTextBySelectorAndValue(selector, value) {
return $(selector + " option[value='" + value + "']").text();
}
Error i get it's Syntax error, unrecognized expression: [object Object] option[value='1']
Seem like selector is not really working
I call this method like
getTextBySelectorAndValue($("#lodgerAppointmentLocation"), $("#lodgerAppointmentLocation").val());