Dropdown on navbar

1

I need a force here for a problem that is killing me.

I can not give action on dropdown on my navbar . I'm using Bootstrap 4.0 and jQuery 3.2.1. Here are my codes:

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script><linkhref="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" rel="stylesheet"/>

<nav class="navbar navbar-light bg-light">

	<a class="navbar-brand" href="publicidade.php">
		<img src="img/home.png" width="30" height="30" class="d-inline-block align-top" alt="">
		Inicio
	</a>
	<a class="dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
		Dropdown
	</a>
	<div class="dropdown-menu" aria-labelledby="navbarDropdown">
		<a class="dropdown-item" href="#">Action</a>
		<a class="dropdown-item" href="#">Another action</a>
		<div class="dropdown-divider"></div>
		<a class="dropdown-item" href="#">Something else here</a>
	</div>
	<a class="navbar-brand" href="relatorioChamados.php">
		<img src="img/consultar.png" width="30" height="30" class="d-inline-block align-top" alt="">
		Relatórios Chamados
	</a>
	<a class="navbar-brand" href="sair.php">
		<img src="img/off.png" width="30" height="30" class="d-inline-block align-top" alt="">
		Sair
	</a>
</nav>

<script>
	$(function()){
		$('.dropdown-toggle').dropdown();
	}); 
</script>
    
asked by anonymous 08.01.2018 / 15:46

1 answer

1

There was an error in where the function() was closed, that is, an unnecessary parenthesis is correct in the example below:

$(function(){
		$('.dropdown-toggle').dropdown();
	});
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script><linkhref="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/js/bootstrap.min.js"integrity="sha384-a5N7Y/aK3qNeh15eJKGWxsqtnX/wWdSZSKp+81YjTmS15nvnvxKHuzaWwXHDli+4" crossorigin="anonymous"></script>
<nav class="navbar navbar-light bg-light">

	<a class="navbar-brand" href="publicidade.php">
		<img src="img/home.png" width="30" height="30" class="d-inline-block align-top" alt="">
		Inicio
	</a>
	<a class="dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
		Dropdown
	</a>
	<div class="dropdown-menu" aria-labelledby="navbarDropdown">
		<a class="dropdown-item" href="#">Action</a>
		<a class="dropdown-item" href="#">Another action</a>
		<div class="dropdown-divider"></div>
		<a class="dropdown-item" href="#">Something else here</a>
	</div>
	<a class="navbar-brand" href="relatorioChamados.php">
		<img src="img/consultar.png" width="30" height="30" class="d-inline-block align-top" alt="">
		Relatórios Chamados
	</a>
	<a class="navbar-brand" href="sair.php">
		<img src="img/off.png" width="30" height="30" class="d-inline-block align-top" alt="">
		Sair
	</a>
</nav>
    
08.01.2018 / 15:51