doubei5310 2014-06-24 06:52
浏览 33
已采纳

Javascript切换不起作用

I have the following code:

<input type="checkbox" onClick="toggle('husob_filter_orderby')" value=""/><?php echo JTEXT::_('FILTER_TH_ORDERBY'); ?></input><br>

<div id="husob_filter_orderby" style="display: none;">
    <select name="orderby" class="select">
        <option value="datetime_asc" ><?php echo JTEXT::_('FILTER_ORDER_DTASC'); ?></option>;
        <option value="datetime_desc"><?php echo JTEXT::_('FILTER_ORDER_DTDES'); ?></option>;
        <option value="ofiden_asc"><?php echo JTEXT::_('FILTER_ORDER_DENASC'); ?></option>;
        <option value="ofiden_desc"><?php echo JTEXT::_('FILTER_ORDER_DENDES'); ?></option>;
    </select>
</div>

The toggle inside the input isnt functioning correctly. When I click the button it just hides the checkbox and doesnt toggle the div.

What is wrong?

EDIT: The toggle function is being called inside an imported file and not very sure where I can locate it. I know the code works because it works on another version of Joomla but not on a newer version.

EDIT 2: I get no javascript errors.

  • 写回答

1条回答 默认 最新

  • duanchun1852 2014-06-24 06:54
    关注

    i dont know what you mean by toggle() and toggle isn't a built-in function but you can also use this for toggle

    <input type="checkbox" onClick="$('#husob_filter_orderby').toggle();" value=""/>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据