「これからのための気持ちの整理。 」

これからのことを考えています。本当に、本当にめんどうくさい、めんどくさい人間です。これからのために、気持ちの整理をします。

inputのtypeを変える

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    type
    <select name="type" id="type" onchange="onChangeType(this)" >
        <option value="text">text</option>
        <option value="tel">tel</option>
        <option value="password" selected>password</option>
    </select>

    <input type="text" id="target">
</body>
<script type="text/javascript">
window.onload = function() {
    onChangeType(
        document.querySelector('#type')
    )
};
function onChangeType(el) {
    let targetType = el.options[el.selectedIndex].value
    document.querySelector('#target').setAttribute('type', targetType)
}
</script>
</html>

f:id:boosuket:20210514021209p:plain

f:id:boosuket:20210514021321p:plain