Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • JavaScript createElement() Method

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 145
    Comment on it

    createElement() Method in JavaScript is used to create a HTML element dynamically.

    lets take an example:

    var select = document.getElementById("selectbox");  //1
    var option = document.createElement('option');
    option.text = "XYZ";
    select.add(option);
    

    the "selectbox" is the Tag name in statement 1 that define the HTML element to be created. for the same purpose the createElement() is used. In a larger scale we can make option in the select box using the same method as done in above.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: