javascript - Calling a function when dropdown toggle is clicked -


i have dropdown-toggle , want call function read(); every time clicked or toggled. there wrong onclick command wherein calling function read(); though toggle not clicked. have tried other commands such ondrop

html:

        <a data-toggle="dropdown" class="dropdown-toggle" onclick="read();">             <i class="fa fa-globe"></i>             <span class="badge">                 <%=unread%>             </span>         </a> 

javascript:

    function read() {         <%             notificationdao.read(((user)session.getattribute("user")).getemployeeid());         %>     } 

guessing using bootstrap data-toggle has own events

$('#mydropdown').on('show.bs.dropdown', function () {     call read method here..  }) 

hope helps.

https://jsbin.com/fayoda/edit?html,js,console,output


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -