jquery Select all prop ("check", True) and attr ("attr", true) difference

Source: Internet
Author: User

$scope. SelectAll =false;//when I click on the Radio box, it's not all selected.$scope. Checkisall =function () {var wipecheckboxobj= $ ("input[name= ' Wipecheckbox ']:checked"); if(wipecheckboxobj.length==$scope. Datalists.length) {        //Select All$scope. SelectAll =true; }Else{$scope. SelectAll=false; }}//Select All, deselect all$scope. Checkallbox =function (selectall) {var wipecheckboxobj= $ ("input[name= ' Wipecheckbox ')"); if(SelectAll) {Wipecheckboxobj.prop ("Checked",true); /**It is best not to use the following, because this will use the problem!!! The most open is the jquery--1.6 version has no attr attribute, only with prop (),
But I changed the high version of jquery Sometimes there is still a problem, the specific problem is not very clear, so it is better to use prop this attribute bar*/ //wipecheckboxobj.attr ("checked", true);}Else{wipecheckboxobj.attr ("Checked",false); }}

//Delete all selected data$scope. deleteallselecteddate =function () {var wipecheckboxobj= $ ("input[name= ' Wipecheckbox ']:checked"); if(!wipecheckboxobj| | Wipecheckboxobj.length==0){        return ; }Else{var finacialvalue= ""; //gets the ID of the selected dataWipecheckboxobj.each (function () {Finacialvalue+= ($( This). Val ()) + ",";        }); //remove the last commaFinacialvalue =finacialvalue.substr (0,finacialvalue.length-1); $http ({URL:'/ecp/financial/deleteallselectedwipedata ', Method:"DELETE", param:{"Selectedwipedatas": Finacialvalue}}). Success (function (data) {if(data== ' true '){                //after the deletion succeeds give the prompt, and refreshes the data!!! var objdiv = "Objdiv";                Startobjmessage (OBJDIV);            $scope. Getalladdedwipeoutdata (); }}). Error (function data) {Console.log ("Operatewipeoutctrl Bulk delete data failed!!!!" ");    }); }}






<tableclass= "Table Table-hover" > <thead> <tr> <thclass= "Col-md-1" style= "Text-align:center" > <!--it's better to use ng-change than Ng-click!!!!!!!!!! Ng-click triggered the possible selectall of the value has not changed, but Ng-change must be selectall value changed before execution!!!!!!!        --<input type= "checkbox" ng-model= "SelectAll" ng-change= "Checkallbox (selectall)" > select all </th> <thclass= "Col-md-1" style= "Text-align:center" > Single &nbsp;&nbsp; number </th> <thclass= "Col-md-1" style= "Text-align:center" > Newspaper &nbsp; sales &nbsp; people </th> <thclass= "Col-md-2" style= "Text-align:center" > Category (Purpose) </th> <thclass= "Col-md-2" style= "Text-align:center" > Items &nbsp;&nbsp; eyes </th> <thclass= "Col-md-2" style= "Text-align:center" > Gold &nbsp;&nbsp; Amount (yuan) </th> <!--<thclass= "Col-md-1" style= "Text-align:center" > class &nbsp;&nbsp; type </th>--> <thclass= "Col-md-1" style= "Text-align:center" > Time &nbsp;&nbsp; Room </th> <thclass= "Col-md-2" style= "Text-align:center" > Operation &nbsp;&nbsp; </th> </tr> </thead> <tbody&    Gt &LT;TR ng-model= "Topics" ng-repeat= "Item in DataLists" > &LT;TDclass= "Col-md-1" style= "Text-align:center" ><input type= "checkbox" ng-click= "Checkisall ()" value= "{{item.id}}" name = "Wipecheckbox" ></td> <tdclass= "Col-md-1" style= "Text-align:center" ><spanclass= "Mr-badge red-bg" >{{item.orderNumber}}</span></td> <tdclass= "Col-md-1" style= "Text-align:center" ><span>{{item.reimbursement}}</span></td> <tdclass= "Col-md-2" style= "Text-align:center" ><span title= "{{item.category}}" >{{item.category}}</span> </td> &LT;TDclass= "Col-md-2" style= "Text-align:center" ><span ng-bind= "Item.project" ></span></td> <tdclass= "Col-md-2" style= "Text-align:center" ><span ng-bind= "Item.money" ></span></td> <!--&LT;TDclass= "Col-md-1" style= "Text-align:center" ><span ng-bind= "Item.type" ></span></td>--> <tdclass= "Col-md-1" style= "Text-align:center" ><span ng-bind= "Item.createdon" ></span></td> <tdclass= "Col-md-2" style= "Text-align:center" ><buttonclass= "Btn Btn-danger btn-xs" ng-click= "DeleteData (item.id, ' Objdiv ')" > Delete </button> | <buttonclass= "Btn btn-success btn-xs" ng-click= "Openpop (item)" > Edit </button></td> </tr> <tr ng-if= "datalists.length==0| | datalists== ' "> &LT;TDclass= "Col-md-2" > No data </td> </tr> </tbody></table>

jquery Select all prop ("check", True) and attr ("attr", true) difference

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.