How to implement a jQuery script to move links

Hello, i have the following script that i use to save web links. The way it works is like this: I have a first page containg an index A-Ö and when you click a index letter you are directed to the links page of this letter. In this page you can click Add link to add a new link and a Title for the link, The links are then shown on the same page. What i need is a script so that i can move and change position on the links. Check out the Web links - Index page here: [URL=“http://test3.fcab.se/links/index.php”] and click eg, on C it is on this page i have added the most links (not only links beginning with C, bot it’s easier to see the funkction of the script on this page).

This is the code i use:


<?php
require("../config.php");
if ($enablegzip == "1")
{
ob_start("ob_gzhandler");
header("Content-Encoding: gzip");
}
session_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="viewport" content="width=device-width, target-densitydpi=high-dpi">
<title>Web links - List (<?php echo basename(dirname(__FILE__));?>)</title>
<LINK REL=StyleSheet HREF="../style.css" TYPE="text/css">
<script language="JavaScript" src="../collapse_expand_single_item.js"></script>
<script language="JavaScript" src="../jquery-1.11.1.js"></script>
</head>
<body topmargin="0" leftmargin="0">
<br>
<div class="link_back"><a href="../index.php"><< Back to Directory</a></div>
<br>
<div a href="#first" onClick="shoh('first');" class="add_link">Add new link <b>+</b></a></div>
<br>
<div class="index_letter"><?php echo basename(dirname(__FILE__));?></div>
<div class="add_links" style="display: none;" id="first">
<div class="box">
<br>
<FORM action=addurl.php METHOD=POST NAME="addurlform">
<table border="0" cellpadding="0" cellspacing="0" width="600">
<tr><td width="100"><div class="box_title">Title:</td></div><td width="600"><INPUT TYPE=TEXT name=text size="56"></td></tr>
<tr><td width="300"><div class="box_link">Drag & Drop Link:</td></div><td width="600"><INPUT TYPE=TEXT value="" name=link size="56"></td></tr>
<tr><td width="100">&nbsp;</td><td width="500"><br><INPUT TYPE=SUBMIT id="add_button" value="Add"></td></tr>
</table>
</form>
</div>
</div>
</div>
<br>
<?
$gbfile='links.txt';
$separator= '|';
//====================================
//This function will add one line to
//the end of file
//====================================
function add($str){
global $gbfile;
      $tmp = trim($str);
      $fp=fopen($gbfile,'a+');
           flock($fp, LOCK_EX);
                fwrite($fp, $tmp. "\
");
           flock($fp, LOCK_UN);
      fclose($fp);
}

//====================================
//Function below gets specified number
//of lines and returns an array
//====================================
function get($start, $end){
global $gbfile;
      $records=array();
      $filename="links.txt";
	  $fp=fopen($gbfile,'r');
           flock($fp, LOCK_SH);
           $i=1;
           $tmp=TRUE;
           while($i<$start && !feof($fp)) {
                $tmp=fgets($fp);
                $i++;
           }
           while($i<=$end && !feof($fp)) {
                $tmp=trim(fgets($fp));
                if ($tmp) { array_push($records, $tmp); }
                $i++;
           }

           flock($fp, LOCK_UN);
      fclose($fp);
      return($records);
}
//Listing part

$start=$_GET['start'];
$end=$_GET['end'];

if (!$end || $start<=0) { $start=1; }
if (!$end) { $end=$linkspage; }
if ($end<$start) { $end=$start+1; }
$show=$end - $start;

//Get records from file into array
      $records = get($start, $end);
	   sort($records);

//For each record get each field
      foreach ($records as $rec) {
           $tmp = explode($separator, $rec);
$title = $tmp[0];
$link = $tmp[1];
//=================================
//Outputting
?>
<table id="table-1" border="0" cellpadding="0" cellspacing="" align="left" width="240" height="0">
<tr>
<td>
<a href="<?=$link?>" target="">
<script>
$("a[href^='http']").each(function() {
    $(this).css({
		background: "url(http://g.etfv.co/" + this.href + ") left center no-repeat",
		"-webkit-background-size": "20px",
		"-moz-background-size": "20px",
		"-o-background-size": "20px",
		"background-size": "20px",
		"padding-left": "20px",
		"margin-left": "10px"
	});
});
</script>
<li class="title"><?php echo("$title");?>
</tr></td>
<table border="0" cellpadding="0" cellspacing="0" align="right" width="240" height="0">
</li></table></a>
<?
}
//Pagination
if ($start>$show) {
      $start-=$show;
      $end-=$show;
      $start--;
      $end--;
      echo "<a href=index.php?start=$start&end=$end><div class=\\"next\\"><<&nbsp;Previous</a></div>";
      if (count($records)!=0) {
      $start+=$show*2;
      $end+=$show*2;
      $start=$start+2;
      $end=$end+2;
	  echo "<a href=index.php?start=$start&end=$end><div class=\\"next\\">Next&nbsp;>></a></div>";
      $start--;
      $end--;
}
else {
      echo "<h3>No more records found!</h3>";
}
}
else {
      $start+=$show;
      $end+=$show;
      $start++;
      $end++;
	  "<a href=index.php?start=$start&end=$end><div class=\\"next\\">Next&nbsp;>></a></div>";
	  $start--;
      $end--;
}
?>
</body>
</html>

Thank you.

Demo page: http://test3.fcab.se/links/index.php

Hi there,

To answer your question, check out: jQuery UI draggable/sortable.
Here’s a link: http://jqueryui.com/draggable/#sortable

However, (with reference to this page) you might want to correct your markup first.
You have lots of invalid HTML, such as:

<a href="http://actdc.co.th/" target="">
<script>
$("a[href^='http']").each(function() {
    $(this).css({
		background: "url(http://g.etfv.co/" + this.href + ") left center no-repeat",
		"-webkit-background-size": "20px",
		"-moz-background-size": "20px",
		"-o-background-size": "20px",
		"background-size": "20px",
		"padding-left": "20px",
		"margin-left": "10px"
	});
});
</script>
<li class="title">ACT</tr></td>
<table border="0" cellpadding="0" cellspacing="0" align="right" width="240" height="0">
</li></table></a>

Running your page through the W3C validator produces 428 errors.
You also repeat that inline script 37 times on the page, where once would do.

Hello, and than’s for the reply. I have looked at the jQuery UI draggable/sortable, but i have not got it to work. The reason for the repeat inline script 37 times it that i have 37 links on the page.
I will have to check out the W3C errors.

Hello, i have now change some code, only 2 W3C errors now, cant get rid of them. I have tried several other jQuery draggable script but i cant get them to work. Any ideas?

Thank you.

Hello, i worked on the jQuery UI draggable/sortable now, but i can only get the first link in list to move, and not chang pace with the other links. Any ideas?

Thank you.

Hi,

Which page are we talking about?
Where can I see draggable/sortable not working?

Demo page: http://test3.fcab.se/links/index.php But i dont even have the draggable/sortable code in it at the moment. But if you are familiar with this maybe you have some ideas? Just enter C in the index page.

Thank you.

I’m afraid there are still 160 errors on that page.

Nothing is going to work as expected whilst you have open/stray tags.

Also, can you help e understand why you are doing this:

$("a[href^='http']").each(function() {
    $(this).css({
		background: "url(http://g.etfv.co/" + this.href + ") left center no-repeat",
		"-webkit-background-size": "20px",
		"-moz-background-size": "20px",
		"-o-background-size": "20px",
		"background-size": "20px",
		"padding-left": "20px",
		"margin-left": "16px"
	});
});

40 times?

This part of the code is only mentiond once in the entire code. This is the code that gets the favicon from the page that i save as a link. So this code is run for avery link. 40 link’s = code 40 times.
New demo page: http://test3.fcab.se/links/temp/index.php No errors. What do you mean by open/stray tags?

I now have this code:

&lt;?php
require("../config.php");
if ($enablegzip == "1")
{
ob_start("ob_gzhandler");
header("Content-Encoding: gzip");
}
session_start();
?&gt;
&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
&lt;meta name="viewport" content="width=device-width, target-densitydpi=high-dpi"&gt;
&lt;title&gt;Web links - List (&lt;?php echo basename(dirname(__FILE__));?&gt;)&lt;/title&gt;
&lt;link rel=StyleSheet href="style.css" type="text/css"&gt;
&lt;script type="text/javascript" src="../collapse_expand_single_item.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="../jquery-1.11.1.js"&gt;&lt;/script&gt;
&lt;script src="http://code.jquery.com/jquery-1.8.2.js"&gt;&lt;/script&gt;  
&lt;script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"&gt;&lt;/script&gt; 
    &lt;script&gt;  
        $(function() {
            $( "#sortable" ).sortable({   
                placeholder: "ui-sortable-placeholder"   
            });  
        });  
    &lt;/script&gt;  
&lt;/head&gt;
&lt;body&gt;
&lt;br&gt;
&lt;div class="link_back"&gt;
&lt;a href="../index.php"&gt;Back to Index&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;div class="add_link"&gt;
&lt;a href="#first" onClick="shoh('first');"&gt;Add new link +&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;div class="index_letter"&gt;&lt;?php echo basename(dirname(__FILE__));?&gt;&lt;/div&gt;
&lt;div class="add_links" style="display: none;" id="first"&gt;
&lt;div class="box"&gt;
&lt;br&gt;
&lt;form action=addurl.php method=POST name="addurlform"&gt;
&lt;div class="box_title"&gt;Title:&lt;/div&gt;&lt;input type=text name=text size="56"&gt;
&lt;div class="box_link"&gt;Drag & Drop Link:&lt;/div&gt;&lt;input type=text value="" name=link size="56"&gt;
&lt;div&gt;
&lt;br&gt;&lt;br&gt;
&lt;input type=submit class="add_button" value="Add"&gt;&lt;/div&gt;
&lt;/form&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;?
$gbfile='links.txt';
$separator= '|';
//====================================
//This function will add one line to 
//the end of file
//====================================
function add($str){
global $gbfile;
      $tmp = trim($str);
      $fp=fopen($gbfile,'a+'); 
           flock($fp, LOCK_EX); 
                fwrite($fp, $tmp. "\
"); 
           flock($fp, LOCK_UN); 
      fclose($fp); 
}

//====================================
//Function below gets specified number
//of lines and returns an array
//====================================
function get($start, $end){
global $gbfile;
      $records=array();
      $filename="links.txt"; 
	  $fp=fopen($gbfile,'r'); 
           flock($fp, LOCK_SH); 
           $i=1; 
           $tmp=TRUE;
           while($i&lt;$start && !feof($fp)) {
                $tmp=fgets($fp);
                $i++;
           }
           while($i&lt;=$end && !feof($fp)) {
                $tmp=trim(fgets($fp));
                if ($tmp) { array_push($records, $tmp); }
                $i++;
           }

           flock($fp, LOCK_UN); 
      fclose($fp); 
      return($records);
}
//Listing part

$start=$_GET['start'];
$end=$_GET['end'];

if (!$end || $start&lt;=0) { $start=1; }
if (!$end) { $end=$linkspage; }
if ($end&lt;$start) { $end=$start+1; }
$show=$end - $start;

//Get records from file into array
      $records = get($start, $end);
	   sort($records);

//For each record get each field
      foreach ($records as $rec) {
           $tmp = explode($separator, $rec);
$title = $tmp[0];
$link = $tmp[1];
//=================================
//Outputting
?&gt;
&lt;div class="wraper"&gt;
&lt;a href="&lt;?=$link?&gt;" target="_self"&gt;
&lt;script&gt;
$("a[href^='http']").each(function() {
    $(this).css({
		background: "url(http://g.etfv.co/" + this.href + ") left center no-repeat",
		"-webkit-background-size": "20px",
		"-moz-background-size": "20px",
		"-o-background-size": "20px",
		"background-size": "20px",
		"padding-left": "20px",
		"margin-left": "56px"
	});
});
&lt;/script&gt;
&lt;p class="title"&gt;&lt;?php echo ("$title");?&gt;
&lt;/p&gt;&lt;/a&gt;&lt;/div&gt;
&lt;?
}
//Pagination
if ($start&gt;$show) {
      $start-=$show;
      $end-=$show;
      $start--;
      $end--;
      echo "&lt;a href=index.php?start=$start&end=$end&gt;&lt;div class=\\"next\\"&gt;Previous&lt;/a&gt;&lt;/div&gt;";
      if (count($records)!=0) {
      $start+=$show*2;
      $end+=$show*2;
      $start=$start+2;
      $end=$end+2;
	  echo "&lt;a href=index.php?start=$start&end=$end&gt;&lt;div class=\\"next\\"&gt;Next&lt;/a&gt;&lt;/div&gt;";
      $start--;
      $end--;
} 
else { 
      echo "&lt;h3&gt;No more records found!&lt;/h3&gt;";
}
}
else {
      $start+=$show;
      $end+=$show;
      $start++;
      $end++;
	  "&lt;a href=index.php?start=$start&end=$end&gt;&lt;div class=\\"next\\"&gt;Next&lt;/a&gt;&lt;/div&gt;";
	  $start--;
      $end--;
}
?&gt;
&lt;/body&gt;
&lt;/html&gt;

No. That’s not how it works :slight_smile:

$("a[href^='http']").each(function() {
   ...
});

This, will iterate over all links on your page, whose href attributes start with “http”.
The code inside the anonymous function will be executed for each link.

$(this).css({ ... });

$(this) is a jQuery object which contains a reference to the current link.
It will change with every iteration.
So it is entirely sufficient to execute the code above once, not 40 times.

Think of it this way: running this code once will iterate over 40 links and do something to them.
Running the code 40 times will iterate over 40 links 40 times (so 1,600 times in total).

Could you include it in the page just once and verify that the code still works.

Then we can get on to the drag and drop bit.

Thank you, but i dont know how i can include it just once. But i will try to figuer it out. Any hint?

Thank you.

You are probably echoing this as part of a loop in your PHP code.
I would look there.

OK, how about now. I moved the $(“a[href^=‘http’]”).each(function() { …
below: <p class=“title”><?php echo (“$title”);?> pleas have a look and tell me if this is ok.

Thank you.

That’s looking better, but if you now open the browser console you can see that the path to the links isn’t always correct

Sorry installed a privacy add on an it had blocked your site.
All good.

Now, all you need to do is wrap the links in a <div id=“sortable”>…</div>, then at the bottom of your script add:

$( "#sortable" ).sortable();
$( "#sortable" ).disableSelection();

And you’ll be able to drag and drop the links :slight_smile:

Demo:

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <base href="http://test3.fcab.se/links/temp" />
    <meta name="viewport" content="width=device-width, target-densitydpi=high-dpi">
    <title>Web links - List (temp)</title>
    <link rel=StyleSheet href="style.css" type="text/css">
    <script type="text/javascript" src="../collapse_expand_single_item.js"></script>
    <script type="text/javascript" src="../jquery-1.11.1.js"></script>
    <script src="http://code.jquery.com/jquery-1.8.2.js"></script>  
    <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script> 
  </head>
  <body>
    <br>
    <div class="link_back">
    <a href="../index.php">Back to Index</a></div>
    <br>
    <div class="add_link">
    <a href="#first" onClick="shoh('first');">Add new link +</a></div>
    <br>
    <div class="index_letter">temp</div>
    <div class="add_links" style="display: none;" id="first">
    <div class="box">
    <br>
    <form action=addurl.php method=POST name="addurlform">
    <div class="box_title">Title:</div><input type=text name=text size="56">
    <div class="box_link">Drag & Drop Link:</div><input type=text value="" name=link size="56">
    <div>
    <br><br>
    <input type=submit class="add_button" value="Add"></div>
    </form>
    <br>
    </div>
    </div>
    <br>
    <div id="sortable" />
    <div class="wraper">
    <a href="http://actdc.co.th/" target="_self">
    <p class="title">ACT</p></a></div>
    <div class="wraper">
    <a href="http://www.swerock.se/sv/Grus--Berg/Berakna-mangden1/" target="_self">
    <p class="title">Beräkna mängden grus</p></a></div>
    <div class="wraper">
    <a href="http://test3.fcab.se/Easy_newsletter/lightof/index.php" target="_self">
    <p class="title">Bulb Captcha</p></a></div>
    <div class="wraper">
    <a href="http://fcab.se/kalender/" target="_self">
    <p class="title">FCAB - Kalender</p></a></div>
    <div class="wraper">
    <a href="http://fcab.se/hemsida_eng/fcabwhiteblue/testpage1.html" target="_self">
    <p class="title">FCAB - White Blue - Mobile</p></a></div>
    <div class="wraper">
    <a href="http://fcab.se/hemsida_eng/fcabwhiteblue/layertest.html" target="_self">
    <p class="title">FCAB - White Blue</p></a></div>
    <div class="wraper">
    <a href="http://shop.fcd.nu/" target="_self">
    <p class="title">FCD - Webshop</p></a></div>
    <div class="wraper">
    <a href="http://support.convergine.com/forum/file-king" target="_self">
    <p class="title">File King Forum</p></a></div>
    <div class="wraper">
    <a href="http://fortawesome.github.io/Font-Awesome/cheatsheet/" target="_self">
    <p class="title">Font Awesome - Cheatsheet</p></a></div>
    <div class="wraper">
    <a href="http://translate.google.com/" target="_self">
    <p class="title">Google Translate 2</p></a></div>
    <div class="wraper">
    <a href="http://google.se" target="_self">
    <p class="title">Google</p></a></div>
    <div class="wraper">
    <a href="http://www.hitta.se/" target="_self">
    <p class="title">Hitta</p></a></div>
    <div class="wraper">
    <a href="http://websemantics.co.uk/online_tools/image_to_data_uri_convertor/result/" target="_self">
    <p class="title">Image to URI Converter</p></a></div>
    <div class="wraper">
    <a href="http://jsfiddle.net/" target="_self">
    <p class="title">JS Fiddle</p></a></div>
    <div class="wraper">
    <a href="http://jobler.se/" target="_self">
    <p class="title">Jobler</p></a></div>
    <div class="wraper">
    <a href="http://jonotech.se/" target="_self">
    <p class="title">Jonotech</p></a></div>
    <div class="wraper">
    <a href="http://fcab.se/hemsida_eng/fcabwhiteblue/jquery_form_test/" target="_self">
    <p class="title">Jquery Form Tests</p></a></div>
    <div class="wraper">
    <a href="http://www.klart.se/" target="_self">
    <p class="title">Klart</p></a></div>
    <div class="wraper">
    <a href="http://fcab.se/hemsida_eng/fcabwhiteblue/layertest.html" target="_self">
    <p class="title">Layer Tests</p></a></div>
    <div class="wraper">
    <a href="http://www.leta.se/" target="_self">
    <p class="title">Leta</p></a></div>
    <div class="wraper">
    <a href="http://fcab.se/mejja/index.html" target="_self">
    <p class="title">Mejjas Fotoalbum</p></a></div>
    <div class="wraper">
    <a href="https://www.internetkassan.com/ifmetall/Index.aspx" target="_self">
    <p class="title">Metall</p></a></div>
    <div class="wraper">
    <a href="http://www.midswedenrebels.se/" target="_self">
    <p class="title">Mid Sweden Rebels</p></a></div>
    <div class="wraper">
    <a href="http://test3.fcab.se/Easy_newsletter/" target="_self">
    <p class="title">My Extensions</p></a></div>
    <div class="wraper">
    <a href="http://fcab.se/hemsida_eng/fcabwhiteblue/pi_extensions.html" target="_self">
    <p class="title">My Other Extensions</p></a></div>
    <div class="wraper">
    <a href="http://nathaliesilen.blogg.se/" target="_self">
    <p class="title">Nathalies Blogg</p></a></div>
    <div class="wraper">
    <a href="http://www.nianclassic.se/" target="_self">
    <p class="title">Nian Classic Cars</p></a></div>
    <div class="wraper">
    <a href="https://www.opencart.com/" target="_self">
    <p class="title">Open Cart</p></a></div>
    <div class="wraper">
    <a href="http://fcab.se/hemsida_eng/fcabwhiteblue/pi_extensions.html" target="_self">
    <p class="title">PI Extensions</p></a></div>
    <div class="wraper">
    <a href="http://test3.fcab.se/alerttest/alert.php" target="_self">
    <p class="title">Styled Contact Form</p></a></div>
    <div class="wraper">
    <a href="https://svenskaspel.se/" target="_self">
    <p class="title">Svenska spel</p></a></div>
    <div class="wraper">
    <a href="https://internetbank.swedbank.se/idp/portal/identifieringidp/idp/dap1/ver=2.0/rparam=execution=e1s2" target="_self">
    <p class="title">Swedbank - Login</p></a></div>
    <div class="wraper">
    <a href="http://fcab.se/hemsida_eng/fcabwhiteblue/jquery_form_test/" target="_self">
    <p class="title">Syled Select - Combobox</p></a></div>
    <div class="wraper">
    <a href="http://theresesilen.blogg.se/" target="_self">
    <p class="title">Theres Blogg</p></a></div>
    <div class="wraper">
    <a href="https://translate.google.com/" target="_self">
    <p class="title">Translate</p></a></div>
    <div class="wraper">
    <a href="http://www.videocopilot.net/" target="_self">
    <p class="title">Video Copilot</p></a></div>
    <div class="wraper">
    <a href="http://videohive.net/" target="_self">
    <p class="title">Video Hive</p></a></div>
    <div class="wraper">
    <a href="http://www.viewlike.us/" target="_self">
    <p class="title">View Like</p></a></div>
    <div class="wraper">
    <a href="http://www.wysiwygwebbuilder.com/forum/index.php" target="_self">
    <p class="title">Wysiwyg Webbuilder Forum</p></a></div>
    <div class="wraper">
    <a href="http://www.yr.no/" target="_self">
    <p class="title">Yr Väder</p></a></div>
    </div>
    <script>
      $("a[href^='http']").each(function() {
          $(this).css({
          background:"url(http://g.etfv.co/"+ this.href +") left center no-repeat",
          "-webkit-background-size": "20px",
          "-moz-background-size": "20px",
          "-o-background-size": "20px",
          "background-size": "20px",
          "padding-left": "20px",
          "margin-left": "56px"
        });
      });
      $( "#sortable" ).sortable();
      $( "#sortable" ).disableSelection();
    </script>
  </body>
</html>

Ooohh, it works i just had to put the last </div> under this:
<?
}
{
$start+=$show;
$end+=$show;
$start++;
$end++;
“<a href=index.php?start=$start&end=$end><div class=\“next\”>Next</a></div>”; [I’m not using this line, if i would use it i can just echo it and i will have a link to the next page of links. This is if i set eg, show 20 links in the config.php file.]
$start–;
$end–;
}
?>
HERE I PUT THE LAST</div>

THANK YOU SO MUCH FOR YOUR HELP.

But now to the next problem. If i change the position for the links, and then update the page all links will be ordered as they use to be. I have to update the changed positions in the links.txt file.
Any idea how i would do this?

Hi,

Looking at the source code you have &lt;div id="sortable"&gt; 40 times. You only need it once!

But apart from that, glad it worked :slight_smile:

Yeah, changes won’t persist beyond a page refresh, so you’ll need some way of remembering them.

Sortable offers an update event which is triggered when the user stopped sorting and the DOM position has changed.

My suggestion would be to use that, however … what do you want to remember?
Currently you have a load of <div> tags with no unique identifier, so your best bet will be to dump the entire HTML to a text file (or whererever) every time the update event is fired.

A more elegant solution would be to us an unordered list (as this is essentially what this is) and give each list item an unique id.
That way you would only need to remember the order of the ids:

&lt;ul id="sortable"&gt;
  &lt;li&gt;&lt;a href="http://actdc.co.th/"&gt;&lt;p&gt;ACT&lt;/p&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="http://www.swerock.se/sv/Grus--Berg/Berakna-mangden1/"&gt;&lt;p&gt;Beräkna mängden grus&lt;/p&gt;&lt;/a&gt;&lt;/li&gt;
  ...
&lt;/ul&gt;

Also, is there any reason for using target = "_self", as this is the default for browsers?

And, you won’t need to add class=“title” to all of your <p> tags, as you can target them thus: ul#sortable p

Regarding the <div id=“sortable”> 40 times. I have tried to chagne the position for the last </div> to run this code only one time but with no luck.
I removed target = “_self”.
Nothing worked when i change the <div id=“sortable”> to <ul id=“sortable”> and change the <p> to <li>, just a long vertical/diagonal/stair list and i can not change position on the links.

what do you want to remember? - Well i’m geting the links from the links.txt file so it is in this file i want to save the new order of the links after i change position of them in the live list.

I’m not getting any ware with this, i’m stuck. Please any ideas? Thank you.:blush: