• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Please help me to enable and disable anchor tag

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Do not set the href for anchor tag. It would look like disabled.
 
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sunglasses. AKA Coolness prosthetic. This tiny ad doesn't need shades:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic