Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to add list dynamically

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 192
    Comment on it

    This is very simple way to add list dynamically using jquery. In this first you have to give Id to select tag then add the script.

    <html>
    <select id="memoryCategories">
          <option>Categories</option>
     </select>
    </html> 
    
    <script>
     var selectchoice = document.getElementById('memoryCategories');
         var categoryData = data.category;
         $("#memoryCategories").html("<option>Categories</option>");
        $.each(categoryData, function(key, value) {
    
        var opt = document.createElement('option');
        opt.value = value;
        opt.innerHTML = value;
        selectchoice.appendChild(opt);
        });
    
        $("#memoryCategories").selectmenu();
            $("#memoryCategories").selectmenu("refresh");
    </script>
    

 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: