I want to change placeholder of a dropdown created by selectize.js when the parent dropdown changes its selection to load the options of the dropdown whose placeholder to be cha
Not sure if selectize keeps changing their code or if everyone else on this thread just whiffed but all of these answers seem to be wrong individually, but if you kind of combine the correct parts from each answer you wind up with this which works for me.
var textHandler = function(name) {
return function() {
if(name == 'focus'){
jQuery("select#myid + .selectize-control").find("input:text").prop({"placeholder": ""});
}
};
};
jQuery('#sf159_textsearchtextsearch').selectize({
closeAfterSelect: true,
hideSelected : true,
createOnBlur : true,
openOnFocus : true,
maxOptions : 10,
persist : true,
placeholder : "Neighborhood, Street, School, Zip, MLS",
plugins : ['remove_button'],
valueField : 'id',
labelField : 'text',
searchField : 'value',
options : [],
create : false,
render : {
option: function (item, escape) {
//console.log(item);
var address = '';
var keyword = '';
var tx = item.text.split(',');
for (var i = 0, n = tx.length; i < n; i++) {
address += '' + escape(tx[i]) + '';
}
var template = '' +
' ' + address + ' ' +
'';
return template;
}
},
load : searchHandler,
onKeydown : keyHandler,
onDelete : deleteHandler,
onFocus : textHandler('focus'),
});