Skip to content

Instantly share code, notes, and snippets.

@sahinsf
sahinsf / gist:5870650
Last active December 19, 2015 00:39
filter selected check boxes
input:checkbox[name="testcases[]"]:checked
//less specific
$('[type="checkbox"]:checked');
//another way
$('input:checkbox:checked.className');
if(checkedTestcases.length<1){
//at least one checked
@sahinsf
sahinsf / ajaxStatus.php
Created September 14, 2012 21:05
jQuery to Backbone step by step
<?php
//if(isset($_POST['text']) && !empty($_POST['text']))
//$text = $_POST['text'];
//$text = array("text" => $text);
$text = json_decode(file_get_contents('php://input'));
//$text -> text .= " said user!";
@sahinsf
sahinsf / gist:3699183
Created September 11, 2012 14:36
Q/A JS + jQuery
http://jquerybyexample.blogspot.com/2011/08/mostly-asked-jquery-interview-questions.html
@sahinsf
sahinsf / filter.js
Created September 4, 2012 20:26
jQuery selector filter
//http://stackoverflow.com/a/3113742/1472649
str.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g,'\\$1');
@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
$('.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 / 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>
@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 / 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 / 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