How do I get html tag value (div) in javascript

后端 未结 7 668
抹茶落季
抹茶落季 2020-12-21 11:01

I have implemented this function (libphonenumber javascript )in a website http://www.phoneformat.com/

How do i get the value returned by this html tag. Whether Yes

相关标签:
7条回答
  • 2020-12-21 12:05

    In vanilla JavaScript you can use document.getElementById to get a specific node using ID:

    var node = document.getElementById('phone_valid');
    

    And then to get the text from that node you will need to use:

    var text = node.innerText || node.textContent;
    

    The jQuery .val() method is used on form fields like input, textarea, select...

    0 讨论(0)
提交回复
热议问题