Commonly used JS notes, may be used in the future

Source: Internet
Author: User

  <Divclass= "Order_head">                <Table>                    <thead>                        <TR>                            <thclass= "TALB1">Product<label><inputtype= "checkbox"class= "Tgbox3">Select All</label>                            </th>                            <th>Price</th>                            <th>Number</th>                            <th>Total</th>                            <th>State</th>                            <th>Operation</th>                        </TR>                    </thead>                </Table>            </Div>                    <Tableclass= "Order_body">                        <thead>                            <TR>                                <thcolspan= "6">                                    <Divclass= "MERGECKB">                                        <inputvalue= "255"type= "checkbox"class= "Tgbox"name= "Mk" />                                    </Div>                                    <P>Order Number:<I>DS180404111619136495</I></P>                                    <P>Time of order:<I>2018/4/4 11:16:19</I></P>                                </th>                            </TR>                        </thead>                        <tbody>                        </tbody>                    </Table>
Keyword search
$ ("#kwdKeyInput"). Focus (function () { function (evt) { var Withevt = (evt)? EVT: ((window.event) window.event: ""); var keycode = Withevt.keycode | | Withevt.which | | Withevt.charcode; if (keycode = =) { $ ('. Or-search ul li Button '). Trigger ("click");}} )
//Select All$ (". Tgbox3"). Click (function () {        //Cancel Select all        if(! This. Checked) {            $(' input[class= ' tgbox ']:checkbox:checked '); varCboxs = $ (' input[class= ' Tgbox "]:checkbox:checked '); $.each (Cboxs,function(index, E) {Removetocookie ($ (e). Val ())}); }        $('. Tgbox '). Prop ("Checked", This. Checked); $(". many"). Text ($ ("thead input[name= ' mk ']:checked"). length); varCboxs = $ (' input[class= ' Tgbox "]:checkbox:checked '); varCIDs = []; $.each (Cboxs,function(index, E) {Cids.push ($ (e). Val ());        }); Addidtocookie ("," +cids); });
 //  Marquee Select event  $ (' input[class= ' tgbox '] ') . Click (function   () {$ ( ". Tgbox3"). Prop ("        Checked ", $ (' Input[name=" mk "]"). Length = = $ (' input[name= "mk"]:checked '  if  (this  .checked)        {Addidtocookie (, "+ $ (this   else   {Removetocookie ($ ( this         
          function Distinct (arr) {var len = arr.length;          Arr.sort ();          for (var i = len-1; i > 0; i--) {            if (arr[i] = = "") {Arr.splice (i, 1);}             if (Arr[i] = = arr[i-1])                {1);}        }         return arr;    }
 //To remove an divisor group    functionRemovetocookie (ID) {varCookie = GetCookie ("orderids") | | ""; varCookiearray = Cookie.split (","); varIDArray = Id.split (","); if(Cookie.indexof (ID) >= 0) {$.each (Cookiearray,function(Index, item) {$.each (IDArray,function(Index2, Iditem) {if(Iditem = =Item) {Cookiearray.splice (index,1);            }                });            }); Delcookie ("OrderIDs"); Setcookie ("OrderIDs", Cookiearray.join (","), 10); }
$(function () {        //Check before selecting the item when loading$ ('. Tgbox '). each (function () {            varAllcookie = GetCookie ("orderids") | | ""; if(Allcookie.indexof ($ ( This). Val ()) >= 0) {                $( This). Prop (' checked ',true);        }        }); //if the selected item equals all items in the current form, the description is select all. $ (". Tgbox3"). Prop ("Checked", $ (' Input[name= "mk"] "). Length = = $ (' input[name= ' mk ']:checked '). length); })

Get form an input box with a name of MK

$ (' input[name= ' mk "])

Gets the text/value selected by a drop-down box

$ ("#RemitCurrency option:selected"). Text ()

$ ("#RemitCurrency option:selected"). Val ()

Get the selected value of a radio box

$ (' input:radio:checked '). Val ()

Commonly used JS notes, may be used in the future

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.