Results 1 to 2 of 2

Thread: Animated Collapse

  1. #1
    Join Date
    Mar 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Animated Collapse

    1) Script Title: Animated Collapse 2.0

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...edcollapse.htm

    3) Describe problem: I have a form placed in div under the animated collapse where the form is shown or hidden on pressing show/hide button.I want to include a key press event for a text box in the form using JQuery.Key press event is not firing.While the same code is fired when the text box is outside of the collapsible div.How can I include a Keypress/keydown event for an element inside the animated collapse?

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    [COLOR="Red"]Having the text box inside a collapsible content DIV shouldn't stop it from receiving onkeypress events. Using the default demo on the DD script page, I've added a text box and textarea inside the 1st collapsible DIV, then attached a keydown event to both of them, which works:

    Code:
    <p><b>Example 1 (individual):</b></p>
    
    <div id="jason" style="width: 300px; background: #FFFFCC; display:none">
    <form>
    <input class="t" type="text" /><br />
    <textarea class="t">sdf ds</textarea>
    </form>
    </div>
    
    <script>
    
    var $t=$('.t') 
    $t.keydown(function(){
    	alert('hi')
    })
    
    </script>


    I suspect the issue might be due to the way you're attaching the event to your own form fields.
    DD Admin

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
  •