0
Opa, next, I have a list of links, what I need is that when typing in a textbox this list is filtered by text, it is possible?
It would be a kind of autocomplete without database.
0
Opa, next, I have a list of links, what I need is that when typing in a textbox this list is filtered by text, it is possible?
It would be a kind of autocomplete without database.
0
The Simplest Way to Do What You Need and Using Angular JS, Look For More About This Javascript Framework Browser.
I leave an example below of how to do the function you need.
<!DOCTYPE html>
<html>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
<script type="text/javascript">
var app = angular.module('meuAPP', []);
app.controller('meuControle', function($scope) {
$scope.listaDeSites = [
{site:"A",link:""},
{site:"AAB",link:""},
{site:"BB",link:""},
{site:"AVCD",link:""}
];
});
</script>
<div ng-app="meuAPP" ng-controller="meuControle">
<input type="text" name="name" ng-model="filtro" value="">
<ul ng-repeat="item in listaDeSites | filter:filtro">
<li><a href="{{item.link}}">{{item.site}}</a></li>
</ul>
</div>
</body>
</html>
Browser other questions tagged javascript
You are not signed in. Login or sign up in order to post.
Let me see etendi, you have say a list already ready in a JSON that contains your links, then you need a select with a text input to filter the list of links, without needing the person to see the whole list to find. and this?
– joao paulo santos almeida
Almost, in the case would not have json, the query would be made in the content inside href, would be a type of suggestions, in which at the time of typing the data would be filtered.
– sNniffer
Ball show, I’m waiting. VLW
– sNniffer