Skip to content

Instantly share code, notes, and snippets.

@xgqfrms-GitHub
Created April 5, 2017 08:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xgqfrms-GitHub/41ef1ad64a7467c3d520ecadaaeaa5c8 to your computer and use it in GitHub Desktop.
Save xgqfrms-GitHub/41ef1ad64a7467c3d520ecadaaeaa5c8 to your computer and use it in GitHub Desktop.
Input bugs
@xgqfrms-GitHub
Copy link
Author

js get <input type="number" value=""> & document.getElementById("myNumber").value;

function myFunction() {
        var value = document.getElementById("myNumber").value;
        alert(value);
        setNumX9('myNumber');
    }
    const setNumX9 = (id) => {
        let input_param = `#${id}`,
            num = document.querySelector(input_param);
        console.log(`%c num`, `color: red`, num);
        console.log(`%c num.value`, `color: red`, num.value);
        console.log(`%c textContent`, `color: red`, num.textContent);
        console.log(`%c num.innerText`, `color: red`, num.innerText);
        console.log(`%c num.innerHTML`, `color: red`, num.innerHTML);
        let showValue = num.value + '\n' + num.textContent + '\n' + num.innerText + '\n' + num.innerHTML;
        console.log(showValue);
        alert(showValue);
    }
const datas = document.querySelectorAll('[data-good="saleNumber"]');

datas[1].value;

datas[1].value.length;

typeof(datas[1].value);

datas[1].value.length > 5 ? datas[1].value = parseInt(99999) : datas[1].value = parseInt(datas[1].value);

input-type number-value querryselectorall array
js-textcontent-innertext-innerhtml

@xgqfrms-GitHub
Copy link
Author

HTML5 input & get input value

    let input_value = document.querySelector(".ant-calendar-picker-input");
    let key = input_value.getAttribute('value');
    console.log(`input_value = ${key}`);

@xgqfrms-GitHub
Copy link
Author

js-get-html5-input-value

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment