If your table isn’t automatically adjusting to the width specified by your CSS, make sure you haven’t set display: inline-block; on the <table> element.
Tag Archives: element
Input keyboard for decimal input on iPhone
So I needed to adjust a value (the odds of a horse winning a race) that has a fractional part and an integer part (i.e. a ‘double’, or ‘float’). The standard numeric input on an iPhone doesn’t include a decimal point, so I needed to trigger a different input device.
I ended up with this:
<input type="number" pattern="[\d\.]*" step="0.01" inputmode="numeric">
Passing selected value into HTML select onchange handler
So you have a <select> element and you want to call a handler, but you need to pass the selected value to the handler because you have multiple instances of the same <select> and can’t access them by ID (because there is many, one of which will have the new selected value, but you don’t know which). The solution is to pass in the newly selected value, like this:
<select onchange='handle_change( this.value )'>
Easy-peasy!
Set toolbar colour with HTML meta element theme-color
See here for example:
<meta name="theme-color" content="#123456">
HTML5 element list
There’s a good article about supported HTML5 elements here: HTML5 element list.
Get element or tag name with jQuery
To get the element/tag name with jQuery:
$( '.selector' ).get( 0 ).tagName