[Solved] Search box placehoder text should change when an option is selected from a drop down list


You need to attach a change event to the select box. In it you grab the text from the selected option and set the placeholder attribute on the search box.

var select_designatfirst = $('#select_designatfirst'),
  empSearch = $('#empSearch');

select_designatfirst.on('change', function () {
  empSearch.attr('placeholder', 'Search ' + select_designatfirst.find(':selected').text());
});

jsFiddle example

That said, unless the search box is far removed from the drop down it probably isn’t necessary to do this. As long as the drop down is appropriately labeled so its function is clear, it should be obvious that it is limiting your search results to only a certain employee type.

solved Search box placehoder text should change when an option is selected from a drop down list