1. Organize default events
Block default events, h5 default input type= ' date ' has no effect on some browsers and Android devices, call the h5+ time selector, but organize the input default click event with the following code:
// select time $ ("#end_time"). On ("click" , function function (E) { var D = e.date; // Console.log (D.format (' yyyy-mm-dd ')); $ ("#end_time"). Val (D.format (' Yyyy-mm-dd ' function (E) {Console.log ( "not Select Date: "+e.message); },{title: Select expiry time, Mindate:new Date () }); });
2. Determine if input type= ' checkbox ' is selected and the code is as follows
if (!$ ("#shopregister #checkaggree"). Is (": Checked")) { alert ("Please agree to the registration agreement"); return false ; }
3. Get the value of the selected one in multiple checkboxes, as shown in the code below
<input name= ' is_refund ' id= ' refund_1 ' type= ' Radio ' value= ' 1 '/><input name= ' is_refund ' id= ' refund_0 ' checked= ' Checked ' type= ' radio ' value= ' 0 '/>$ ("#shopregister input[name= ' is_refund ']:checked '). Val ();
4. Get the value of the title property in multiple pictures
User.id_pic1 = $ ($ ("#shopregister. Id_pic") [0]). attr ("title"); = $ ($ ("#shopregister. Id_pic") [1]). attr ("title"); = $ ($ ("#shopregister. Id_pic") [2]). attr ("title");
Show progress picture in 5.ajax submission process
$.ajax ({type:' POST ', Url:configManager.RequstUrl+ "/api/user/createstore", Data:postdata, Beforesend:function() {$ ("#waitingupload"). Removeclass ("Heisebghid"). AddClass ("HEISEBG").);} }). Done (function(data) {$ ("#waitingupload"). Removeclass ("HEISEBG"). AddClass ("Heisebghid").); if("success" = =data.state) {//Server success } Else{//server failed}}). Fail (function() {//ajax request failed});
JavaScript Corner knowledge