i using kendodropdownlist project , replacing select box options script.
i want add css class placeholder if select optionlable (-- please select --
)
please check below reference image talking about..
html
<select id="selectbox" data-bind="value: index, source: newoptions"> <option>{label 1}</option> <option>{label 2}</option> <option>{label 3}</option> </select>
script
$("#selectbox").kendodropdownlist({ valueprimitive: true, datatextfield: "text", datavaluefield: "value", optionlabel: "-- please select --" }); var icsnew = kendo.observable({ index: 2, newoptions: [ { value: 1, text: "my option 1" }, { value: 2, text: "my option 2" }, { value: 3, text: "my option 3" } ] }); kendo.bind($("#selectbox"), icsnew);
css
.k-dropdown{border:1px solid #ccc;} .placeholder{color:red;}
you can achieve optionlabeltemplate
:
$("#selectbox").kendodropdownlist({ ... optionlabel: "-- please select --", optionlabeltemplate:'<span style="color:red">-- please select --</span>', ... });
Comments
Post a Comment