So I'm making this thing in jQuery where if the user clicks a button a div appears and asks the user to enter some notes(basically a sticky note feature).
The HTML and CSS are done correctly, the only problem is that the jQuery won't work:
$(document).ready(function() {
$("#top-tabs ul li").hover(function() {
$(this).find("ul>li").stop().fadeToggle(400);
});
$("#submitpnote").on("click", function() {
$("body").append("<div id='pnoteprompt'><input id ='input-pnote'type='text' placeholder='your note title'></input><input id ='input-pnote-p'type='text' placeholder='your note'></input><button id=confirmpnote>confirm note</button></div>");
$("#pnote-prompt").fadeTo(100, 1);
});
$("#confirmpnote").on("click", function() {
var $pnotetitle = document.getElementById("input-pnote").value;
var $pnotep = document.getElementById("input-pnote-p").value;
$("#pnotes-list").append("<div class='pnote-title'><li>" + $pnotetitle + "<br>" + $pnotep + "</li></div>");
$("#pnoteprompt").remove();
});
});
The js jQuery file is linked properly. It's just that in the submitpnote function(the second on), the div doesn't append. I click the button and nothing appears on my screen. I've tried putting some prompt() debuggers and the method is running but the div doesn't seem to be appending.
Does anyone know why this is happening? Thanks!
" "with' '?$("body").append('<div id="pnoteprompt"><input id="input-pnote" type="text" placeholder="your note title"></input><input id="input-pnote-p" type="text" placeholder="your note"></input><button id="confirmpnote">confirm note</button></div>');Html attributes have to have double quotes, not single ones.