Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable link to current page number. (anchor tag)

Tags:

javascript

I have one anchor tag. I want to disable it after once it clicked. I tried the following way.

  print "<script type='text/javascript'>parent.window.frames[2].document.getElementById('pagination').innerHTML+=\"<a href=# onclick='pageshow`($i);this.disabled=true'>$i</a>&nbsp;\"</script>";

Note: I don't want to disable the link. I want to disable the link operation. Like Google search page.

Eg: 1 2 3 4 5 Next

Here once I clicked the 1st page I can't click the same page again. Same thing I want.

like image 898
user285146 Avatar asked Dec 13 '22 23:12

user285146


2 Answers

You can also disable the anchor tag by using the following way.

<a href='URL' style='text-decoration:none;cursor: auto;' onClick='return false'>LINK</a>
like image 196
vivek Avatar answered Dec 21 '22 01:12

vivek


Having reread the question…

Google do not "Disable the link after it has been clicked".

They just don't link to the current page. Their markup is appalling so I won't copy it, a simplified example (for page 2) would be:

<ol>
  <li><a>1</a></li>
  <li>2</li>
  <li><a>3</a></li>
  <li><a>4</a></li>
</ol>  
like image 42
Quentin Avatar answered Dec 20 '22 23:12

Quentin