SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict dr_dumb99's Avatar
    Join Date
    Sep 2004
    Location
    Pakistan
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Select corresponding Radio Button on Focus of text box

    Hi!
    How can I make corresponding radio button 'CHECKED' [from a group of radio 4 buttons] when a related textbox gets focus?

    I mean what javascript method will be fired upon 'OnFocus' event of textbox?

    Thanks in advance

  2. #2
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    onfocus would ...

  3. #3
    SitePoint Addict dr_dumb99's Avatar
    Join Date
    Sep 2004
    Location
    Pakistan
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any solution?

  4. #4
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not entirely sure, what you're asking, but try this:
    HTML Code:
    <textarea id="ta"></textarea>
    <input type="checkbox" id="cb" />
    <script>
    var ta = document.getElementById("ta");
    var cb = document.getElementById("cb");
    ta.onfocus = function() {
      cb.checked = true;
    }
    </script>


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
  •