• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please help me to enable and disable anchor tag

 
praveen michael
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem in disabling anchor tag.

Let me tell the scenario...

I have a page that contains a checkbox and two button images inside two anchor tags.

<table>
<tr>
<td><input type="checkbox" id="chk1">I Agree</td>
</tr>
</table>

<div>
<a ><img />Submit</a>
<a ><img />Reset</a>
</div>

- This submit button should be disabled by default.
when clicks on checkbox it should enable.

- When click on the reset it has to uncheck the check box and disable the submit button.
- Please make this code for IE and firefox
Can you please anyone help me?
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The most easy way would be , but not sure if this is efficient way
[code]

function call() { // call this function from checkbox
var a= document.getElementById("a1");
a.href="/link2";
}

<a id="a1" >Submit</a>
<a id="a2" >Reset</a>

[/code]
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you considered dropping the anchor? Around 200 fathoms of chain should do.
 
praveen michael
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please elaborate the code??

I have to set the submit anchor tag disabled true first.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Do not set the href for anchor tag. It would look like disabled.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please take the time to choose the correct forum for your posts. This forum is for meaningless drivel posts. For more information, please read this.

This post has been moved to a more appropriate forum.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Balu Sadhasivam wrote:Do not set the href for anchor tag. It would look like disabled.
Not so. It will simple appear as normal text in most browsers.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<a ><img />Submit</a>

What is up with this construct? is this really the way you have your HTML arranged? Really? If so, why?

Why aren't you using a real button element?
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
Balu Sadhasivam wrote:Do not set the href for anchor tag. It would look like disabled.
Not so. It will simple appear as normal text in most browsers.


yeah i meant that
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic