Nguồn: http://stackoverflow.com/questions/8141125/regex-for-password-php
Function load css with jquery
Function_loadCSS = function(href) { var cssLink = $(“<link>”); $(“head”).append(cssLink); //IE hack: append before setting href cssLink.attr({ rel: “stylesheet”, type: “text/css”, href: href }); };
Loading multiple javascript files bằng jquery
$.when( $.getScript( “/mypath/myscript1.js” ), $.getScript( “/mypath/myscript2.js” ), $.getScript( “/mypath/myscript3.js” ), $.Deferred(function( deferred ){ $( deferred.resolve ); }) ).done(function(){ //Khi load xong các file js });
Check sự kiện click hoặc move element bằng jquery
var isMove = false; $(element ) .mousedown(function() { isMove= false; }) .mousemove(function() { isMove = true; }) .mouseup(function() { if(isMove){ alert(‘click element’); }else{ alert(‘di chuyen element’); } });
di chuyển và phóng to thu nhỏ element bằng jquery
1. Di chuyển $(“element”).draggable({ }); https://jqueryui.com/draggable/ 2. Phóng to thu nhỏ $(“element”).resizable({ }); https://jqueryui.com/resizable/
Demo code xoay http://tayori.com/
http://jsfiddle.net/3ax5f03e/
Validate password jquery sử dụng regexp
Validate password trên trình duyệt chúng ta có thể sử dụng regexp. Cụ thể từ project mình đang làm, mình xin phép viết code ra như sau:
Xuống dòng khi in text trong textarea
echo nl2br(“string”);
Woocommerce
1) Lấy ra danh sách các category $args = array( ‘taxonomy’ => ‘product_cat’, ‘orderby’ => ‘ID’, ‘order’ => ‘ASC’, ‘hierarchical’ => 1, ‘hide_empty’ => 0 ); $all_categories = get_categories( $args ); Lấy link của 1 category : <?php echo get_term_link($c->slug, ‘product_cat’);?>