Layui+jfinal templates in HTML for front-end search functionality

Source: Internet
Author: User

 <inputtype= "text"ID= "Campus"class= "Layui-input"onkeyup= "ck (this.value);"placeholder= "Please enter the English house to find">//Input Trigger box<Divclass= "Layui-input-block layui-form"ID= "Cam"Lay-filter= "Cam">This is the container for the campus to be displayed, this page is rendered</Div>//Template data//Because this piece uses the Layui statement and the jfinal statement, you need to put the Layui # with the jfinal # to make Layui as a normal string output<Scripttype= "text/html"ID= "SearchText">        # for(X:campuskit.findlistbyaccount (loginaccount))//jfinal statements, loops        {{#("#")  if(Iscontains ("# (X.campusname)", D.val)) { }}//here is a statement with Layui and Jfinal, # (X.campusname) jfinal statement, {{# ("#") if (Iscontains ("# (X.campusname)", D.val)) {}} In the D.val because if with the Layui statement, so directly write can, generally {{d.val}} This write                <input type='checkbox'value="# (X.id)"name='Campus'# (Sysaccountcampusids.contains (x.id.tostring ())? 'checked= "Checked"':"') Title="# (X.campusname)"ID='campusbox# (x.id)'>        {{#("#") }}} #end</Script>//str Whether the string contains substr string function Iscontains (str, substr) {return str.indexof (substr) >= 0;} Layui template of the way var gettpl = searchtext.innerhtml;//written to the outside of the JS method to load only once, not every time loading, fast */* Front page Search */function ck (campusname) {//Render Template Layui.laytpl (GETTPL). Render ({"Val": Campusname},//json value function (HTML) {$ ("#cam"). HTML (HTML);//jqu ery loading the template into the div ID is cam<DivID= "Cam"></Div>Console.log (HTML); Layui.form.render (null, "cam");      Update the page in this container}); }

Record learning process ...

Big bro really bad. All kinds of Metropolis ...

Layui+jfinal templates in HTML for front-end search functionality

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.