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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -