Category Archives: jQuery

jQuery codes

jQuery Reviewer

What is jQuery? It is a JS library with a motto – write less, do more. It simplifies various tasks by writing less code. What are the features of jQuery? DOM Manipulation Event Handling AJAX Support Animations Lightweight – about … Continue reading

Posted in jQuery | Leave a comment

Promises

Promises – uses same ajax call on multiple pages var promise = $.Deferred(); – create a new promise object promise.resolve(value); – calls the done callback: promise.done(function(value){ }); promise.reject(value); – calls the fail callback: promise.fail(function(value){…}); $.when(promise1, promise2…) – takes any number … Continue reading

Posted in jQuery

jQuery Ajax

XMLHttpRequest: example ActiveX for IE5 and IE6: code XMLHttpRequest Object: Methods & Properties Call Ajax: $.ajax(url[, setting]) $(‘.confirmation’).on(‘click’, ‘button’, function() { $.ajax(‘url’, { success: function(response) { $(‘.ticket’).html(response).slideDown(); }, data: {“confNum”: 1234 / $(“.ticket”).data(“confNum”) }, error: function(request, errorType, errorMessage) { alert(“Error:” + errorType + “with … Continue reading

Posted in jQuery | Tagged , , , , ,

jQuery CSS Styling

.css(<attr>, <value>): css({prop: ‘value’}); $(this).css(‘background-color’, ‘#252b30’); $(this).css({‘background-color’: ‘#252b30′,’font-weight’: ‘bold’}); Add/Remove Class: addClass() & removeClass() ToggleClass: toggleClass() Animation: animate()

Posted in jQuery | Tagged , ,

Array

Remove Value from Array: https://css-tricks.com/snippets/jquery/remove-specific-value-from-array/

Posted in jQuery | Tagged ,

Check

Check if Element Exists: https://css-tricks.com/snippets/jquery/check-if-element-exists/ Check if Element is inside Another Specific Element: https://css-tricks.com/snippets/jquery/test-if-element-inside-element/

Posted in jQuery | Tagged ,

Form

Get and Calculate Value: val() Copy Input Value: val() Password Strength: https://css-tricks.com/snippets/jquery/password-strength/ Get Checked Radio Value: $(‘input[name=”…”]:checked’).val(); Autochecked Checkbox: prop(‘checked’, true); Count Character in Text Form: code Check if Checkbox is Checked: https://css-tricks.com/snippets/jquery/check-if-checkbox-is-checked/ Check if at least One Checkbox is Checked: https://css-tricks.com/snippets/jquery/test-if-at-least-one-checkbox-is-checked/ Clear a File Input: https://css-tricks.com/snippets/jquery/clear-a-file-input/ Disable / Re-enable … Continue reading

Posted in jQuery | Tagged , , , , , , , , , ,

jQuery Reference

$() is the same as jquery() jQuery Cheat Sheet: http://overapi.com/jquery jQuery UI: https://jqueryui.com/ jQuery Plugin: https://plugins.jquery.com/ jQuery API: https://api.jquery.com/ Designing with jQuery Event Handler: $(‘selector’).on(“event”, “childSelector”, function) Custom Event: $(‘selector’).on(“event.namespace”, method) Removing Event Handler – off(): $(‘button’).off(‘click.image’); Trigger Events – trigger(): $(‘button’).trigger(‘click’); Namespacing Events: $(‘button’).on(‘click.image’, picture); / $(‘button’).on(‘click.details’, status); … Continue reading

Posted in jQuery | Tagged , , , , , , , , , , , , , ,

Setting

Setting Container Height: css(“min-height”, … ); Setting Window Height: height() Setting Attributes: https://css-tricks.com/snippets/jquery/working-with-attributes/  

Posted in jQuery | Tagged , , , , , ,