Results 1 to 2 of 2

Thread: Disabling control not disabling its onclick event

  1. #1
    Join Date
    Apr 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Disabling control not disabling its onclick event

    Hi All,

    I use a javascript to enable/disable (based on my business criteria) a html control using its 'disabled' property. It works fine but I see even if the control is disabled, its onclick event is fired. How to avoid this? ( ie. I do not want the onclick event to fire when the control is disabled.)

    Thanks,
    SSD

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Not enough information. If you have an input element and you disable it, it's onclick will not fire. If on the other hand, you are using a link (<a>) tag, the disabled attribute doesn't technically apply to it, if a particular browser gives any effect to it for a link, it is not standard, and as a result, unpredictable. If you don't want an event to fire, remove it.

    If you need more help:

    Please post a link to the page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •