自定义或可重用的HTML组件 [英] Custom or Reusable HTML component
问题描述
我们可以在HTML中创建自定义或可重用组件吗?
我的网页具有使用HTML,JS,jQuery代码实施的帐户搜索功能。我的网页包含在不同地方的帐户搜索。 (功能同样强悍)。只有div的ID在我们每次使用时才会改变。
那么我们可以想出HTML中的某种组件吗?
同样,将代码写入单独的文件并且包含在不同的位置不会像每个区域的ID更改一样工作。 ID的问题,因为我们打电话给服务器,获取数据和更新字段等。
以下框架有助于解决问题:
我宁愿使用HandleBar(写在Mustache上面)。
Can we create custom or reusable components in HTML?
My page has account search functionality which is implemented using HTML, JS, jQuery code. And my page consists of account search at different places. (Functionality is same tough). Only ID of the div changes at each time we using it.
So can we come up with kind of components in HTML?
Again, Writing the code in separate file and including at different locations wont work as ID changes at each area. ID matter as we make call to server, get data and update the fields etc.
Following frameworks helps to solve the problem:
I prefer to use HandleBar (which is written on top of Mustache).
这篇关于自定义或可重用的HTML组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!