自定义或可重用的HTML组件 [英] Custom or Reusable HTML component

查看:87
本文介绍了自定义或可重用的HTML组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以在HTML中创建自定义或可重用组件吗?



我的网页具有使用HTML,JS,jQuery代码实施的帐户搜索功能。我的网页包含在不同地方的帐户搜索。 (功能同样强悍)。只有div的ID在我们每次使用时才会改变。



那么我们可以想出HTML中的某种组件吗?

同样,将代码写入单独的文件并且包含在不同的位置不会像每个区域的ID更改一样工作。 ID的问题,因为我们打电话给服务器,获取数据和更新字段等。

解决方案

以下框架有助于解决问题:



胡须



HandleBars



我宁愿使用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:

Mustache

HandleBars

I prefer to use HandleBar (which is written on top of Mustache).

这篇关于自定义或可重用的HTML组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆