Created
November 11, 2017 23:33
-
-
Save bbagno/8f7301cf92fe322ffc70e9a4cd620930 to your computer and use it in GitHub Desktop.
app.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var guid = function() { | |
var s4 = function() { | |
return Math.floor((1 + Math.random()) * 0x10000) | |
.toString(16) | |
.substring(1); | |
} | |
return s4() + s4() + s4() + s4() + s4() + s4() + s4() + s4(); | |
} | |
var add_li = function(task_text) { | |
var li_id = guid(); | |
$('#mainul').append( | |
'<li id="' + li_id + '">' + | |
'<span>' + task_text + '</span>' + | |
'<input type="button" onclick="$(\'#' + li_id + '\').remove()">' + | |
'</li>' | |
) | |
} | |
$(document).ready(function() { | |
$('#root').append( | |
'<ul id="mainul"></ul>' + | |
'<hr>' + | |
'<input id="add_task_input">' + | |
'<input type="button" id="add_task" onclick="add_li($(\'#add_task_input\').val())">' | |
) | |
add_li("Сделать задание #3 по web-программированию") | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment