Home / 2015 / Temmuz

Monthly Archives: Temmuz 2015

check all checkboxes chk

//This code checks/unchecks all checkboxes within the same fieldset. Simple and semantic. //HTML Setup //Add checkboxes however you like, just make sure they are within the same fieldset (or other element). /* <fieldset> <!-- these will be affected by check all --> <div><input type="checkbox"> Check all</div> <div><input type="checkbox"> Checkbox</div> <div><input ...

Read More »

Belli bir yaşın üzerindekileri kaydetmek için.

<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> </head> <body><form name="demoForm" id="demoForm" action=""> <input type="hidden" name="requiredAge" id="requiredAge" value="18"> <h4>Enter Birth Date</h4> <p>Day: <input type="text" name="birthDay" id="birthDay" value=""></p> <p>Month: <input type="text" name="birthMonth" id="birthMonth" value=""></p> <p>Year: <input type="text" name="birthYear" id="birthYear" value=""></p> <input type="submit" name="submit" value="Submit"> </form> <script language="JavaScript1.2"> $("#demoForm").submit(function(){ var day = $("#birthDay").val(); var ...

Read More »

Rakamsal inputlara rakam girmeye zorlama

$(document).ready(function() { $("#txtboxToFilter").keydown(function(event) { // Allow only backspace and delete if ( event.keyCode == 46 || event.keyCode == 8 ) { // let it happen, don't do anything } else { // Ensure that it is a number and stop the keypress if (event.keyCode < 48 || event.keyCode > 57 ...

Read More »

select kontrollerinde seçili değeri daha hızlı atamak için

$(function(){ $('select[value]').each(function(){ $(this).val(this.getAttribute("value")); }); }); //The Markup Looks Like This <select name="category" id="category" value="PHP"> //NOTICE value attribute!!! <option value="ARTICLE">ARTICLE</option> <option value="PHP">PHP</option> //THIS IS THE DEFAULT OPTION <option value="MySql">MYSQL</option> <option value="jQuery">jQuery</option> <option value="CSS(3)">CSS(3)</option> </select>

Read More »

formun birçok kere submit edilmesinin engellenmesi.

$(document).ready(function() { $('form').submit(function() { if(typeof jQuery.data(this, "disabledOnSubmit") == 'undefined') { jQuery.data(this, "disabledOnSubmit", { submited: true }); $('input[type=submit], input[type=button]', this).each(function() { $(this).attr("disabled", "disabled"); }); return true; } else { return false; } }); });

Read More »

cookielerde set, get, delete

//get cookie function getCookie( name ) { var start = document.cookie.indexOf( name + "=" ); var len = start + name.length + 1; if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) { return null; } if ( start == -1 ) return null; ...

Read More »

elemanın dizide olup olmadığı kontrolü

//jQuery version jQuery.inArray("value", arr); // Usage: if( jQuery.inArray("value", arr) != -1 ) { true }; //Javascript version Array.prototype.inArray = function (value) { var i; for (i=0; i < this.length; i++) { if (this[i] === value) { return true; } } return false; }; //[1,2,3].inArray(2) > true //[1,2,3].inArray(22) > false

Read More »

setInterval setTimeout

var timer = setInterval(function(){ if(someConditionIsTrue){ clearTimeout(timer); } },100); /*But if, due to some reasons, the 'someCondition' never gets true than you need to clear the timer otherwise it might turn into an infinite loop*/ setTimeout("clearTimeout(timer)",10000) //10 seconds or more

Read More »

Elemanlar arasında gezinmek.

$("div#home").prev("div"); // find the div previous in relation to the current div $("div#home").next("ul"); // find the next ul element after the current div $("div#home").parent(); // returns the parent container element of the current div $("div#home").children("p"); // returns only the paragraphs found inside the current div

Read More »