Skip to content

Instantly share code, notes, and snippets.

@sahinsf
sahinsf / gist:2783271
Created May 24, 2012 18:20
checboxes
//just add a class for files only and apply how many selected
var notchecked = $('input'+topLevelClass(splittedClassNames)+':not(:checked)').length;
var checked = $('input'+topLevelClass(splittedClassNames)+':checked').length;
var all = $('input'+topLevelClass(splittedClassNames)).length;
@sahinsf
sahinsf / gist:2853220
Created June 1, 2012 16:06
cross Browser
Select Element:
There are no events on the option element in IE.
The change event on select is the only cross-browser-compatible way to be informed of a change of option.
Note that keyboard navigation may also fire this event.
@sahinsf
sahinsf / 1.html
Created June 13, 2012 17:34
jQuery 30 - Basics
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<title>HTML Document</title>
<style type="text/css">
ul li{color: red;}
.emphasis{color: green;}
</style>
</head>
@sahinsf
sahinsf / jq30.js
Created June 13, 2012 20:21
jQ30-Complete
//The POINTS
window.jQuery = window.$ = jQuery
using CSS selector or jQuery helper or jQuery method // $('li:first-child') vs. $('li':first) || $('li').first()
this refferring the regular DOM node
$(this) jQuery wrapped // jQuery methods can be used
use direct used JQ methods instead of refferred helper methods
@sahinsf
sahinsf / documentation.txt
Created June 14, 2012 20:33
jQuery Practice | Traversing | Events | Selectors | Manipulation | Ajax | Effects
http://api.jquery.com/category/selectors/
http://api.jquery.com/category/traversing/
@sahinsf
sahinsf / custom.js
Created June 27, 2012 20:49 — forked from drewjoh/custom.js
Dynamic (AJAX) loaded Bootstrap Modal (Bootstrap 2.0)
$(document).ready(function() {
// Support for AJAX loaded modal window.
// Focuses on first input textbox after it loads the window.
$('[data-toggle="modal"]').click(function(e) {
e.preventDefault();
var href = $(this).attr('href');
if (href.indexOf('#') == 0) {
$(href).modal('open');
} else {
@sahinsf
sahinsf / 10.html
Created July 13, 2012 19:47
jQ-30 Effects
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Effect Speeds / Custom Effect Methods</title>
<style>
p { margin-top: 0;}
</style>
</head>
<body>
$('.frdtPicker').datetimepicker({
onClose: function(dateText, inst) {
var endDateTextBox = $('.todtPicker');
if (endDateTextBox.val() != '') {
var testStartDate = new Date(dateText);
var testEndDate = new Date(endDateTextBox.val());
if (testStartDate > testEndDate) {
var testStartDate = new Date(dateText).getTime() + 60000;
var testStartDate2 = new Date(testStartDate);
@sahinsf
sahinsf / nav.js
Created August 28, 2012 19:38
//Top Navigation, adding .active class to a tab upon navigation
//Top Navigation, adding .active class to a tab upon navigation
$(function(){
//deactivate default click action in # <a> links in navbar
$('.nav [href^=#]').click(function (e) {
e.preventDefault()
});
var url = window.location.pathname,
// create regexp to match current url pathname and remove trailing slash if
//present as it could collide with the link in navigation in case trailing slash wasn't present there
@sahinsf
sahinsf / filter.js
Created September 4, 2012 20:26
jQuery selector filter
//http://stackoverflow.com/a/3113742/1472649
str.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g,'\\$1');