Get the current value

Hello, i have this script that when i right click an object i get an prompt and then i can change the Title and The url link on this object. My problem is that i can only get the current Title/Link from one obejct (the last one) not the one that i’m right clicking if this is not the last one that is. You can check out my script here and try to right click the first object (the text)
Now you will have a prompt in that you can change the Title and then the Link, but you will see that it will show the current Title/Link of the second object.

Demo: http://test3.fcab.se/kundnr/C/index.php

This is the code i have now:

$('.titles').on("mousedown", function(event) {
if (event.which === 3){
var newTitle = prompt("Enter New Title", "<?php echo ("$title");?>");
var newTitle = prompt("Enter New Title", "<?php echo ("$link");?>");
if(newTitle){
$(this) .text (newTitle);
$("#sortable").trigger("sortupdate");
}
}
});

And the Titles/Links are stored in a text file.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.