add below script to your /etc/rc.local
exec 2> /tmp/rc.local.log # send stderr from rc.local to a log file exec 1>&2 # send stdout to the same log file set -x # tell sh to display commands before execution
exec 2> /tmp/rc.local.log # send stderr from rc.local to a log file exec 1>&2 # send stdout to the same log file set -x # tell sh to display commands before execution
Bower is a front-end package manager built by Twitter. Also known as a Package manager for the Web, bower is used in modern open source and closed source projects to solve many recurrent issues. install bower $npm install -g bower (need install node.js,git) 常用指令 install package $bower install $package show current veresion and latest version $bower list ex: startbootstrap-sb-admin-2#1.0.7 C:\Users\1409035\git\MartBackStage ├─┬ bootstrap#3.3.4 (3.3.5 available) │ └── jquery#2.1.3 (3.0.0-alpha1+compat available) ├─┬ bootstrap-social#4.8.0 (latest is 4.9.1) │ ├── bootstrap#3.3.4 (3.3.5 available) │ └── font-awesome#4.2.0 (latest is 4.3.0) ├─┬ datatables#1.10.6 (1.10.7 available) │ └── jquery#2.1.3 (3.0.0-alpha1+compat available) ├── datatables-plugins#1.0.1 (latest is 1.10.7) ├─┬ datatables-responsive#1.0.5 (1.0.6 available) │ ├── datatables#1.10.6 (1.10.7 available) │ └── jquery#2.1.3 ├─┬ flot#0.8.3 │ └── jquery#2.1.3 (3.0.0-alpha1+compat available) ├── flot.tooltip#0.8.4 (0.8.5 available) ├── font-awesome#4.2.0 (latest is 4.3.0) ├── holderjs#2.4.1 (latest is 2.8.1) ├─┬ jquery-ui#1.11.4 extraneous │ └── jquery#2.1.3 (3.0.0-alpha1+compat available) ├─┬ metisMenu#1.1.3 (latest is 2.0.2) │ └── bootstrap#3.3.4 (3.3.5 available) └─┬ morrisjs#0.5.1 ├── jquery#2.1.3 (3.0.0-alpha1+compat available) ├── mocha#1.17.1 (latest is 2.2.5) └── raphael#2.1.4 uninstall package $bower uninstall $package update package $bower update $package conclusion: In the past, when we want to use the plugin, must first go to the website to download and unzip it to your purpose folder, And you have to keep track of plug has not been updated, If so, you have to repeat the action again. now! use bower, you do not have to worry about this problem.
$('.class2 , .class3, .class3').on('click', function() { alert(this.className); location.href = "test.htm"; });
var countries = {}; countries.results = [ {id:'AF',name:'Afghanistan'}, {id:'AL',name:'Albania'}, {id:'DZ',name:'Algeria'} ]; Array.prototype.removeValue = function(name, value){ var array = $.map(this, function(v,i){ return v[name] === value ? null : v; }); this.length = 0; //clear original array this.push.apply(this, array); //push all elements except the one we want to delete } 說明: countries.results.removeValue('name', 'Albania'); //移除掉key為'name' ,value為'Albania' 的那項item Array.prototype.removeValue //為Array這個object增加removeValue這個function. var array = $.map(this, function(v,i){ return v[name] === value ? null : v; }); //jquery的traversing object功能, callback function裡面 //可以程式來對object做動作,做完再回傳到呼叫他的地方. this.push.apply(this,array) //將array所有內容家到原本的array裡面, 你可以想成jabva的 addAll 總結: 說穿了其實就是把json array 用for-loop跑完, 將符合標準的取出. 最後再放回json array裡面 //=============================================================== ref: http://api.jquery.com/jquery.map/ http://codex.wiki/post/147898-659/ http://stackoverflow.com/questions/1374126/how-to-extend-an-existing-javascript-array-with-another-array
假設 navbar-brand 為用jquery load進來的html 此時下面寫法無法執行 $("a.navbar-brand").on("click", function() { //code here }); 解法一 不要用jquery load 進html, 解法二 Event Delegation ex: $(document).on("click", 'a.navbar-brand', function() { //code here }); ref:http://www.cnblogs.com/moonreplace/archive/2012/10/09/2717136.html