About the manipulation of Dom objects pieced together with JSON and the way Easyui are submitted

Source: Internet
Author: User

The JSON-pieced DOM object cannot be found directly with. class or #id. How to find me, and I didn't figure out a specific rule. Anyway, try several methods will find out, here I used the native JS
The jquery selector is also used

//Add right FlowfunctionAddl () {vard=$ ("#dg2"). DataGrid ("GetSelected")); varStr= "<tr><td class=" onclick= ' TD (This) ' id= "+d.id+" > "+d.username+" </td></tr> "; $("#table"). append (str);}//When you click TD, add StylefunctionTD (a) {varCls= "TRTD"; varCl=a.getattribute ("Class"); if(cl==NULL|| cl== "") {A.classlist.add ("TRTD"); }Else{a.classname=""; } }//Remove Right Flowfunctionremovel () {varT = $ ("#table"). Find ("tr TD[CLASS=TRTD]"); $ (t). Remove (); }

2. In the process of using Easyui, it is found that data returned after the form form submission is parsed using Eval. The rest of the AJAX request methods such as $.ajax, $post, $get these returned data is not required to be parsed with eval, directly can be data. Out of the properties

var result=eval (' (' +data+ ') '); --easyui,form Submit

3. Adding a Delete class attribute to the object to which the JSON is spelled by using JS

Let's say HTML5 's newly added Classlist property (Ie10 below) Add a method Add (Class1, Class2, ...) to add one or more class names to the element. Use the [JavaScript] view plain Copy to view the code slices on codes to derive to my Code slice document.getElementById ("id"). Classlist.add ("A", "B", "C" ) );  Added three classes to DOM object if you need to erase all of the original, re-add the method of using the assignment [JavaScript] view plain copy on code to see a snippet derived from my Code slice document.getElementById ( "id"). className = "Class";  

About the manipulation of Dom objects pieced together with JSON and the way Easyui are submitted

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.