Article From:https://www.cnblogs.com/7q4w1e/p/9549275.html

According to ID value

if(document.getElementById(“type”)){

                document.getElementById(“type”).value=type;

            }

Link of this Article: Judging whether it exists

Leave a Reply

Your email address will not be published. Required fields are marked *