How to change the text color of first select option

If the first item is to be used as a placeholder (empty value) and your select is required then you can use the :invalid pseudo-class to target it. select { -webkit-appearance: menulist-button; color: black; } select:invalid { color: green; } <select required> <option value=””>Item1</option> <option value=”Item2″>Item2</option> <option value=”Item3″>Item3</option> </select>

Detect changed input text box

You can use the input Javascript event in jQuery like this: $(‘#inputDatabaseName’).on(‘input’,function(e){ alert(‘Changed!’) }); In pure JavaScript: document.querySelector(“input”).addEventListener(“change”,function () { alert(“Input Changed”); }) Or like this: <input id=”inputDatabaseName” onchange=”youFunction();” onkeyup=”this.onchange();” onpaste=”this.onchange();” oninput=”this.onchange();”/>

Python check for integer input

You’re using eval, which evaluate the string passed as a Python expression in the current context. What you want to do is just data = raw_input(‘Enter a number: ‘) try: number = int(data) except ValueError: print “I am afraid %s is not a number” % data else: if number > 0: print “%s is a … Read more