Loading...
jQuery

Jquery Kodları

Seçiciler

$(“i[data-inx=’1′]”);
$(‘*[data-customerID=”22″]’);
$(‘[data-test~=”foo”]’);
input[type=checkbox]
input[type=checkbox]:checked
input[type=checkbox]:not(:checked)
input[type=text]
$(‘<input>’).is(‘:text’);
$(“:input[type=text][readonly=’readonly’]”).val(“”);
$(“:input[type=text]:not([readonly=’readonly’])”).val(“”);


Extend

var object = $(‘formPost’).serializeArray();
var object2 = {prc: ‘show_document’};
$.extend( object, object2 );
JSON.stringify( object );


For

var values = $(‘#data’).val();
for(var i = 0; i < values.length; i += 1) {
$(‘#dataOutput’).append(“<span class=’removeable’><span class=’reel’>” + values[i] + “</span> x </span>”);
}
});


Auto expand all textarea:

$(‘div’).on( ‘change keyup keydown paste cut’, ‘textarea’, function (){
$(this).height(0).height(this.scrollHeight);
}).find( ‘textarea’ ).change();


Switch

switch(data.prc[6]){
case ‘people_first’:
break;
}


Ajax

$.ajax({

type: “POST”,
async: false,
url: $hostPath+’/include/get_back_data.php’,
data: postData,
dataType: “json”,
success: function (msg) {
var paramList = $.trim(msg);
},
error: function (jqXHR, textStatus, errorThrown) {
alert(“get session failed ” + jqXHR);
}

});