JavaScript - Update HTML List

Status
Not open for further replies.

lazenes

Banned
Banned
Member
Joined
Threads
132
Posts
414
This member is banned. Please avoid dealing with banned members.
2019-12-03_23_08_53-index.html_.png


In this tutorial we will create a Update HTML List using JavaScript. This code will update an list value when the user click it and enter the new value. The code use onclick() to call a certain function that can update an list value by adding an array index position as a parameter in the Edit(). You can apply this script to your code to make your transaction faster, it is a user-friendly program feel free to modify it.

We will use JavaScript to add some new feature to the website interface by actually written into an HTML page. It is what gives your page a different interactive elements and animation that engage a user.

Getting Started:
This is the link for the bootstrap that i used for the layout design .

The Main Interface
This code contains the interface of the application. To create this just write these block of code inside the text editor and save this as index.html.
HTML:
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1"/>
        <link rel="stylesheet" type="text/css" href="css/bootstrap.css"/>
        <style>
            .el{
                cursor:pointer;
            }
        </style>
    </head>
<body>
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <a class="navbar-brand" href="<a href="https://sourcecodester.com">Sourcecodster</a>
" rel="nofollow">https://sourcecodester.com">Sourcecodster</a>
</a>        </div>
    </nav>
    <div class="col-md-3"></div>
    <div class="col-md-6 well">
        <h3 class="text-primary">JavaScript - Update HTML List</h3>
        <hr style="border-top:1px dotted #ccc;"/>
        <div class="col-md-4">
            <form action="javascript:void(0);" method="POST" class="form-inline" id="update">
                <label>Movie Name:</label>
                <input type="text" id="movie_name" class="form-control"/>
                <br /><br />  
                <center><button type="submit" id="btn_update" class="btn btn-warning"><span class="glyphicon glyphicon-update"></span> Update</button> <button type="button" class="btn btn-danger" id="btn_cancel" onclick="Cancel()">Cancel</button></center>
            </form>
        </div>
        <div class="col-md-8">
            <h3>MY MOVIE LIST</h3>
            <ul id="result"></ul>
        </div>
    </div>
</body>
<script src="js/script.js"></script>
</html>
Creating the Script


This code contains the script of the application. This code will update an list value when the button is clicked. To do this just copy and write these block of codes as shown below inside the text editor and save it as script.js inside the js directory
You must reply to see the hidden content. Consider upgrading your account to increase your reply limit.
There you have it we successfully created a Update HTML List using JavaScript. I hope that this simple tutorial help you to what you are looking for. For more updates and tutorials just kindly visit this site. Enjoy Coding!
 
  • lazenes
    Created
  • Last reply
  • 0
    Replies
  • 1K
    Views
  • 1
    Participants
  • Participants list
Status
Not open for further replies.