我有一个主页,我想添加一个搜索框来过滤我的以下代码,并根据搜索框中提供的位置显示唯一的信息。如何使用javascript实现搜索过滤器?
<input type="text" class="form-control" id="searchText" placeholder="Search by location.."/>
@foreach (var scr in Model)
{
<li>
<div class="date">
<div class="month">
@scr.DateTime.ToString("MMM")
</div>
<div class="day">
@scr.DateTime.ToString("d ")
</div>
</div>
<div class="details1">
<div><strong>@scr.TeamA vs @scr.TeamB</strong><small> (@scr.Competition.Name) </small>
</div>
<div>@scr.Organizer.Organizer</div>
<div><small>@scr.Organizer.Street, @scr.Organizer.City</small>
</div>
</div>
<div class="details2">
<input class="btn btn-info" type="button" value="Details" onclick="location.href = '@Url.Action("Details", "Screenings")?id=' + @scr.Id"/>
</div>
</li>
}