I'm trying to implement an automatic save using javascript/jQuery.
I have several (hundreds) of overlay-rotation-bounding-box
-id elements. For example, overlay-rotation-bounding-box-968
would be the 968th element on my list. I want to auto save every time I change one of these elements. I'm kinda new to this so I tried to make it really simple and I used this snippet:
var autosaveOn = false;
console.log(autosaveOn)
function myAutosavedTextbox_onTextChanged() {
console.log(autosaveOn);
if (!autosaveOn) {
autosaveOn = true;
$('#overlay-rotation-bounding-box').everyTime("30", function () {
$.ajax({
type: "POST",
url: "autosavecallbackurl",
data: "id=1",
success: function (msg) {
$('#autosavenotify').text(msg);
}
});
}); //closing tag
}
}
However, it does nothing. I guess I'm selecting the element in the wrong way. What is the correct way to develop a auto save function for an element that appears more than once and the id is based on its index?
Kind regards