I have just started learning jQuery. I was trying to make a todo list from user inputs. I have attempted to capture the value from input field and pass on to the input type of radio. But though, the value is passed, the created element is not displaying the user input. My code is given below
jQuery
$("#addtodo").click(function(){
var newtodo = $("#todoinputval").val(); /*Getting input value when and storing it*/
$("#todoinputval").val(" "); /*Resetting input field*/
var newradio = $("<input type='radio'>").val(newtodo); /*creating a variable to be appended to my desired div */
$("#radiotodo").append(newradio); /* Appending it to my desired div*/
});
HTML
<input id="todoinputval" type="text"><br>
<button id="addtodo">Add</button>
<div id="radiotodo"></div>
label