www.webdeveloper.com
Results 1 to 3 of 3

Thread: invoking onChange action when programmatically changing checkbox state

  1. #1
    Join Date
    Feb 2010
    Posts
    2

    invoking onChange action when programmatically changing checkbox state

    Hi, I'd like to know if it's possible to invoke associated onChange action of check box when changing it's state with another javascript command... ie.

    <input type="checkbox" name="y" onChange="javascript: func('var');">
    document.x.y.field[i].checked = true;

    When I execute last line I'd like func('var') to be run as well. Unfortunately it doesn't happen as of in the example above.

    Thanks

  2. #2
    Join Date
    Jun 2007
    Posts
    667
    Code:
    <input type="checkbox" name="y" onChange="func('var');">
    document.x.y.field[i].checked = true;
    document.x.y.field[i].onchange();

  3. #3
    Join Date
    Feb 2010
    Posts
    2
    excellent, thank you.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles