Normally, we have placeholder for input and textarea field. The placeholder will be in gray colored text when you start typing it will turn into black but what about select box? We don’t have any placeholder attribute for select dropdown. In this tutorial, I’ll show you how to create placeholder for select dropdown using jquery. We need, select dropdown Select value should be in gray color and option should be in black. First of all, create normal select box
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | //normal select box //HTML<select> <option value="">Select value</option> <option value="value 1">value 1</option> <option value="value 2">value 2</option> <option value="value 3">value 3</option> </select> //CSS select { color: #000; height:30px; width:200px; border:1px solid #ccc; font-size:14px; padding:0 10px; } |
Here, Select value and value 1, value 2.. everything will…read more