html文件: 我使用了一些div,并且在内部引入了一些标题和图像。
在搜索栏中,我只想输入标题时在搜索时在屏幕上显示整个div。
@Autowired
userEmailCacheEntityRepository repo;
//check in database and get email
List<String> strEmails = repo.getUserEmails(userId);
//if not found in database
if (strEmails.isEmpty()) {
//fetch email from LDAP/Active Directory
String ldapMail = retrieve();
} else {
LOG.info("[I] Found in DB {} results for {}: {}", strEmail.size(), userId, strEmail);
}
//save in Database
UserEmailCacheEntity file = new userEmailCacheEntity();
file.setUserEmail(ldapMail);
file.setUserId(userId);
repo.save(file);
file.js
<body>
<div class="input">
<input type="text" placeholder="Search.." id="searchbar" onkeyup="search_bar()">
<button type="submit"><i class="fa fa-search"></i></button>
</div>
<div class="s10plus" id="divs">
<h2>Samsung Galaxy S10 Plus</h2>
<img src="Images/s10plus.png"></img>
<p id="precios10">Price : $600</p>
</div>
<div class="samsunga10">
<h2>Samsung Galaxy A10</h2>
<img src="Images/a10.png"></img>
<p id="precioa">Price:$600</p>
</div>
<div class="samsunga20">
<h2>Samsung Galaxy A20</h2>
<img src="Images/a20.png"></img>
<p id="precio">Price:$600</p>
</div>
</body>
答案 0 :(得分:0)
您可以共享一个Codepen或Codesandbox还是在此处添加一个片段?
在您的Js代码中: 未定义“ li”,这使得很难准确理解您的代码。 另外,将显示设置为“”不是有效的CSS属性。我建议将其设置为显示:“继承”。
“ s10plus”类位于:
var ul = document.getElementsByClassName('s10plus');
将始终获得1个元素,因为在您的html中只有一个div具有该类。
尝试调整这些问题,看看能否进一步解决