$(".positive-integer").numeric({ decimal: false, negative: false }, function() { alert("Positive integers only"); this.value = ""; this.focus(); });
Więcej przykładów znajduje się tutaj i tutaj.
$(".positive-integer").numeric({ decimal: false, negative: false }, function() { alert("Positive integers only"); this.value = ""; this.focus(); });
jQuery.fn.extend({
live: function( types, data, fn ) {
if( window.console && console.warn ) {
console.warn( "jQuery.live is deprecated. Use jQuery.on instead." );
}
jQuery( this.context ).on( types, this.selector, data, fn );
return this;
}
});
var rege = /^([0-9]{2})+\/([A-Z0-9]{3})+\/([0-9]{2})+\/([0-9]{5})$/;
if(rege.test($("#badane_pole"))){
//gogogo!
}
$.post("test.php", { "func": "getNameAndTime" },
function(data){
console.log(data.name); // John
console.log(data.time); // 2pm
}, "json");
dać
echo "zwykly ciag znakow";
echo json_encode(array("name"=>"John","time"=>"2pm"));
var idleka_search = $("#idleka_search");
var idkorg_search = $("#idkorg_search");
var idfdm_search = $("#idfdm_search");
var combined = idleka_search.add(idkorg_search);
combined = combined.add(idfdm_search);
$(combined).change(function(){ ... });
var zmienna = $("#zmienna").val();
if(typeof zmienna !== "undefined" && zmienna){
alert(zmienna);
} else {
alert("brak zmiennej lub pusta");
}
function wczytajCos(){
$.get('cos.php?cl=foo', zrobCos);
}
function zrobCos(data){
alert(data);
}
var datawiz = top.window.$("#datawiz").val();
$(document).ready(function(){
function bye(e) {
location.href = "logout.php";
}
window.onbeforeunload=bye;
$("#nazwaBody").mousedown(function(){
window.onbeforeunload=null;
});
});
<script type='text/javascript' src='autologout.js'></script>
<body id="nazwaBody">
function getQueryParams(qs) {
qs = qs.split("+").join(" ");
var params = {};
var tokens;
while (tokens = /[?&]?([^=]+)=([^&]*)/g.exec(qs)) {
params[decodeURIComponent(tokens[1])]
= decodeURIComponent(tokens[2]);
}
return params;
}
var $_GET = getQueryParams(document.location.search);
// Add jQuery
var GM_JQ = document.createElement('script');
GM_JQ.src = 'http://jquery.com/src/jquery-latest.js';
GM_JQ.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(GM_JQ);
// Check if jQuery's loaded
function GM_wait() {
if(typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(GM_wait,100); }
else { $ = unsafeWindow.jQuery; letsJQuery(); }
}
GM_wait();
// All your GM code must be inside this function
function letsJQuery() {}