Jackson Tale
Jackson Tale

Reputation: 25812

How can I disable a link in HTML at beginning and enable it afterwards?

I have a HTML web page. The left side bar has come links for navigation.

The logic is that at the very beginning, most of those links (<a> tags) are supposed to be disabled.

Only after user finishes some operations inside the web page, those links are enabled.

So how can I achieve that? How can I disable <a>s first, then re-enable them later?

Upvotes: 2

Views: 196

Answers (3)

Dejan Stuparic
Dejan Stuparic

Reputation: 595

Why you do not do it on server side. For example in ASP you can set anchotTagId.Enabled = false; on PageLoad and after user finish action that you need you can say anchorTagId.Enabled = true;

Upvotes: 0

Christoph
Christoph

Reputation: 51181

disable the functionality be replacing the href with some no-op like href="javascript:;" and adding the real stuff later.

Or add a handler which supresses the default event (with return false; or jQuerys .preventDefault()).

Upvotes: 2

Dipak
Dipak

Reputation: 12190

Try using jquery .preventDefault()

Link - http://api.jquery.com/event.preventDefault/

But you have to use it in if condition

if maxwords
   preventDefault
else
   return true

Upvotes: 0

Related Questions