I have it:
$(document).on("click", ".prev", function(){ $(this).closest("div").find(".slider").animate({ "left": "+=450px" }, 800, "easeInOutBack"); return false; });
What works when new elements are added to the DOM, but it does not work for elements that are already in the DOM.
When I do this:
$(".prev").on("click", function(){ $(this).closest("div").find(".slider").animate({ "left": "+=450px" }, 800, "easeInOutBack"); return false; });
It works for elements in the DOM, but does not add new ones in the DOM. Is there a way for me to get this to work for both without me, to write this 2 times or call another function?
Here is a screenshot:

So here is a more detailed description of how this works.
<div id="simple-pevs" style="padding-right: 20px;"> <?php require_once __DIR__ . "/data/get/PEVSection.php"; ?> </div>
Then, when someone wants to add another section, click the add button, which then runs this code:
$(".add-another-pev").click(function(){ $.get("./data/get/PEVSection.php?pev="+pevGroup, function(data){ $("#simple-pevs").append(data); }); pevGroup++; return false; });
As you can see, it calls the same one that was preloaded in php. The new one works (and any other additional ones are added) with the click event, and the first does not
@ArunPJohny
console.log($(".prev")); after adding a new item:
[a.prev, a.prev, prevObject: b.fn.b.init[1], context: document, selector: ".prev", jquery: "1.9.1", constructor: functionâĻ] 0: a.prev 1: a.prev context: #document length: 2 prevObject: b.fn.b.init[1] selector: ".prev" __proto__: Object[0]