PDA

View Full Version : Animated Collapse



merryba
03-07-2011, 07:57 PM
1) Script Title: Animated Collapse 2.0

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.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?

ddadmin
03-08-2011, 04:33 AM
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:


<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>

[COLOR="Red"]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.