MyBB Community Forums

Full Version: Dropdown Menu don't work in mybb 1.8.20
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I upgrade mybb to 1.8.20 from 1.8.19, but when i click a dropdown icon that don't work... on Chrome Console i see this error:

jquery.js?ver=1806:2 Uncaught Error: Syntax error, unrecognized expression: #
    at Function.ga.error (jquery.js?ver=1806:2)
    at ga.tokenize (jquery.js?ver=1806:2)
    at ga.select (jquery.js?ver=1806:2)
    at Function.ga [as find] (jquery.js?ver=1806:2)
    at r.fn.init.find (jquery.js?ver=1806:2)
    at new r.fn.init (jquery.js?ver=1806:2)
    at r (jquery.js?ver=1806:2)
    at b (bootstrap.min.js:6)
    at HTMLAnchorElement.g.toggle (bootstrap.min.js:6)
    at HTMLDocument.dispatch (jquery.js?ver=1806:3)

This is my dropdown menu html code:

<li style="margin-top: 27px;height: 0;margin-left: 10px;" class="li-more">
        <a data-target="#" href="#" data-toggle="dropdown" class="dropdown-toggle" style="padding: 0;">
		<main><i class="tt label fa fa-chevron-down" title="CLICK" style="display: block;padding: 7px;background: rgba(250, 250, 250, .1);font-size: 14px;"></i></i></main>
		</a>
        <ul class="dropdown-menu" style="margin-top: 55px;background-color: rgba(56, 62, 71, 1);">
            <li class="vmore"><a href="{$mybb->settings['bburl']}/search.php?action=unreads"><i class="fa fa-eye-slash" style="margin-right: 5px;"></i>Unread Posts</a></li>
            <li class="vmore"><a href="{$mybb->settings['bburl']}/search.php?action=getnew"><i class="fa fa-eye" style="margin-right: 5px;"></i>{$lang->welcome_newposts}</a></li>
            <li class="vmore"><a href="{$mybb->settings['bburl']}/search.php?action=getdaily"><i class="fa fa-eye" style="margin-right: 5px;"></i>{$lang->welcome_todaysposts}</a></li>
	        <li class="vmore"><a href="{$mybb->settings['bburl']}/misc.php?action=help" title="FAQ"><i class="fa fa-support" style="margin-right: 5px;"></i>{$lang->toplinks_help}</a></li>
        </ul>
    </li>
You probably have deprecated jQuery codes in your custom dropdown function.
A link to the problematic page may help debugging further ...

EDIT:
try removing data-toggle="dropdown" and see what happens ...
I tried to remove data-toggle="dropdown", but nothing happened.
The site is this www.heroxwar.com/Forum/index.php
try

<li style="margin-top: 27px;height: 0;margin-left: 10px;" class="li-more">
        <a data-target="#" href="#" data-toggle="dropdown" id="menu1" class="dropdown-toggle" style="padding: 0;">
 <main><i class="tt label fa fa-chevron-down" title="CLICK" style="display: block;padding: 7px;background: rgba(250, 250, 250, .1);font-size: 14px;"></i></i></main>
 </a>
        <ul class="dropdown-menu" role="menu" aria-labelledby="menu1" style="margin-top: 55px;background-color: rgba(56, 62, 71, 1);">
            <li class="vmore"><a href="{$mybb->settings['bburl']}/search.php?action=unreads"><i class="fa fa-eye-slash" style="margin-right: 5px;"></i>Unread Posts</a></li>
            <li class="vmore"><a href="{$mybb->settings['bburl']}/search.php?action=getnew"><i class="fa fa-eye" style="margin-right: 5px;"></i>{$lang->welcome_newposts}</a></li>
            <li class="vmore"><a href="{$mybb->settings['bburl']}/search.php?action=getdaily"><i class="fa fa-eye" style="margin-right: 5px;"></i>{$lang->welcome_todaysposts}</a></li>
        <li class="vmore"><a href="{$mybb->settings['bburl']}/misc.php?action=help" title="FAQ"><i class="fa fa-support" style="margin-right: 5px;"></i>{$lang->toplinks_help}</a></li>
        </ul>
    </li>
@xSavior_of_God
using multiple instances of jQuery is not recommended & such usage could be problematic
[eg. jquery.js & jquery.min.js should not be loaded on the same page]

MyBB 1.8.20 has different version numbers for the main javascript files.
compare your theme's headerinclude template with the stock theme of MyBB
I fixed the bug by changing the following lines in headerinclude Template:

ORIGINAL
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/jquery.js?ver=1812"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/jquery.plugins.min.js?ver=1812"></script>


CHANGED

<script type="text/javascript" src="{$mybb->asset_url}/jscripts/jquery.js?ver=1813"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/jquery.plugins.min.js?ver=1813"></script>

Thanks for help.