slideDown,slideUp在jQuery中不起作用 [英] slideDown, slideUp not working in jQuery

查看:591
本文介绍了slideDown,slideUp在jQuery中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Friends的slideDown和slideUp功能不适用于我的代码.出现了没有slideDown效果的隐藏行.请您帮我下面的代码或 在此处查看小提琴

Hi Friends slideDown and slideUp function are not working with my code. It appears the hidden row without slideDown effect PLease help guys you can chekc my code below or see fiddle here

HTML

<table>
<tr>
    <td colspan="2"><p>Logistics</p>
      <select name=" " >
        <option>one</option>
        <option>two</option>
        <option>three</option>
        <option>four</option>
        <option>Others</option>
      </select>
    </td>
  </tr>
  <tr>
    <td width="80%" colspan="2"><textarea name=" 5" rows="2" id=" 5" onblur="if (this.value=='') this.value = this.defaultValue" onfocus="if (this.value==this.defaultValue) this.value = ''">Others Details</textarea>
      </td>
  </tr>
</table>

脚本

$('tr').has('textarea').hide();
$('select').on('change',function(){
    if($(this).val()=='Others')
    {
        //$(this).next('tr td').has('textarea').slideDown(200);
        $(this).parent('td').parent('tr').next('tr').slideDown(200);
        //alert('other')
        }
    else
    {
        //$(this).next('tr td').has('textarea').slideDown(200);
        $(this).parent('td').parent('tr').next('tr').slideUp(200);
        //alert('other')
        }
    })

推荐答案

选中此 演示jsFiddle

$('tr').not(':first').children('td').wrapInner('<div>');
$('select').on('change',function(){
    if($(this).val()=='Others')
    {
        $('td > div').slideDown(2000, function() {
            $(this).parent().slideDown(2000);
        });
    }
    else
    {
        $('td > div').slideUp(1000, function() {
            $(this).parent().slideUp();
        });
    }
});

这篇关于slideDown,slideUp在jQuery中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆