The invention relates to the field of
JavaScript, and particularly provides a method and a device for binding
HTML (
Hypertext Markup Language) element rendering, comprising the following steps: S1, creating a js file named render; s2, declaring a class in the js file, and naming the class as Render; s3, a construction function constructor is written in the Render, the function constructor needs a parameter data, and the data is a
Json object; the key of the data is the id attribute value of the
HTML element, and the value of the data corresponds to data to be rendered; s4, in the construction function, declaring that pointing to render, and assigning this; the parameter data of the construction function is put into the attribute data of the render; an empty
Json object is prepared in the render attribute, the attribute is named as htmls, and the
Json object is used for storing rendering elements; and S5,
processing the data in the construction function. Compared with the prior art, the method is high in
usability, easy to operate and simple in binding configuration, and the complexity of the data rendering process is reduced.