http://jsbin.com/palavuso/1/edit
You start with a blank canvas. Click the add button and BAM.... we have a button
$(".add-query").on('click', function() { $(".beauty-btns").append("<a class='" + $('.mediaquery-slider').val() + "' href='javascript:void(0)'>" + $('.mediaquery-slider').val() + "px</a>"); // Remove Query $(".beauty-btns").find("a").on('click', function() { $(this).remove(); }); }); Simple I know; However what if the class or ID already exists?
Well if it's a class we can add multiple, but not in my experiment.
What I'm trying to do is add the button, but if the class already exists alert the user and ask them if they want to replace the button or cancel.
I know I can use window.confirm for the alert process here, but after that I'm confused.
Example:
var x = window.confirm("Are you sure you want to refresh the page?") if (x) location.reload(true); else return false; Any help is greatly appreciated.