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
    • 149
    Comment on it

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

    lets take an example:

    1. var select = document.getElementById("selectbox"); //1
    2. var option = document.createElement('option');
    3. option.text = "XYZ";
    4. 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
Reset Password
Fill out the form below and reset your password: