タイピング関係@ wiki
javascriptとか置き場
最終更新:
tube
-
view
取得系
const a = document.getElementById('id名');
const a = documentTagName('タグ名');
const a = document.getElementsByClassName('クラス名');
const a = documentTagName('タグ名');
const a = document.getElementsByClassName('クラス名');
const a = document.querySelector('[class="クラス名"]');
その他
const a = document.createElement("HTMLのタグ");
a.type = '下のタイプ一覧から使いたい物を選んで入れる';
a.id = '設定したいid';
a.innerHTML = 'ここにHTML';
a.id = '設定したいid';
a.innerHTML = 'ここにHTML';
HTMLのタグにinputにすると下のtype一覧のものが使える
type一覧
type='radio'
type='checkbox'
type='range'
type='image' src='画像の場所' style.width='25px' style.height='25px'
type='button' value= 'ボタン'
type='submit'
type='reset'
type= 'color'
type= 'file'
type='search'
type='tel'
type='text'
type='url'
type='number'
type='password'
type='email'
type='time'
type='week'
type='month'
type='datetime-local'
色々
場所.appendChild(入れたい物);
※場所のリストの一番最後に追加される
※場所のリストの一番最後に追加される
const basho = document.getElementById('special_type');
const mozi = document.createElement("h1");
mozi.innerHTML = 'あいうえお';
basho.appendChild(mozi);


const basho = document.getElementById('special_type');
const mozi = document.createElement("h1");
mozi.innerHTML = 'あいうえお';
basho.parentNode.appendChild(mozi);
場所.parentNode.appendChild(入れたい物);
※場所が入っているリストの一番最後に追加される


※場所が入っているリストの一番最後に追加される


const ireruyatu = document.createElement("input");
ireruyatu.type = 'text';
ireruyatu.id = 'test';

const basho = document.getElementById('special_type');
const ireruyatu = document.createElement("input");
ireruyatu.type = 'text';
ireruyatu.id = 'test';
basho.appendChild(ireruyatu);


document.addEventListener('keypress', osu);
function osu(e) {
if(e.code === 'Enter'){
alert("あいうえお");
}
}