Those at work (1), those at work
1. toastr
Http://www.jq22.com/jquery-info476
2. jquery1.11.1 checkbox
Front-end js Code:
// Select all function CheckAll (e) {if ($ (e ). attr ("checked") = "checked") {$ (e ). removeAttr ("checked"); $ (": checkbox [name = 'cbxstudent ']"). removeAttr ("checked");} else {$ (e ). attr ("checked", true); // Add attribute $ (e ). prop ("checked", true); // equivalent to refreshing the page $ (": checkbox [name = 'cbxstudent ']"). attr ("checked", true); // Add attribute $ (": checkbox [name = 'cbxstudent ']"). prop ("checked", true); // equivalent to refreshing the page} // single-choice function CheckOne () {var checkNums = $ (": checkbox [name = 'cbxstudent '] "). length; // The total number of checkboxes var checkedNums =$ (": checkbox [name = 'cbxstudent ']: checked "). length; // The total number of checkboxes selected if (checkNums = checkedNums) {$ ("# cbxStudentAll "). prop ("checked", true); // equivalent to refreshing the page} else {$ ("# cbxStudentAll "). removeAttr ("checked ");}}
The checked attribute of the attr method is not changed, but the property of the prop method is changed, and the checkbox of the page is not checked. The combination of the two methods is normal, which may be a version issue.
3. jquery $. each ()
Var jsonClass = '{"classes": [{"classname": "Class 1", "classid": "1" },{ "classname": "Class 2 ", "classid": "2" },{ "classname": "Class 3", "classid": "3 "}';
$. Each (json. classes, function () {options + = "<option value = '" + this. classid + "'>" + this. classname + "</option> ";})
4. jquery's method of getting and setting outerhtml
$(".test").prop("outerHTML");$('.test').prop('outerHTML', '<input>');
5. Search for class! = "Sel" | class = "sel" a tag
$("#classList").find("a:not(.sel)");$("#classList").find("a.sel");
6. jquery concatenates json data
var jsonClass = '{ "classes": [';var jsonContent = "";$.each($ClassA, function () { classname = $(this).text(); classid = $(this).attr("id"); classid = classid.substr(7, classid.length) jsonContent += '{ "classname": "' + classname + '", "classid": "' + classid + '" }' + ",";});if (jsonContent.length > 0) { jsonContent = jsonContent.substr(0, jsonContent.length - 1);}jsonClass += jsonContent + '] }'; var json = eval("(" + jsonClass + ")");
7. jquery select options
$("#select_classes option:selected").val();
8. Close button & times;