Quantcast
Channel: Gik's notes » javascript
Browsing latest articles
Browse All 10 View Live

Image may be NSFW.
Clik here to view.

JQuery ajax request

Next example demonstarates Login method: var backEndpath = '/backend'; function unparam(p) {   // http://stackoverflow.com/questions/1131630/javascript-jquery-param-inverse-function/4764403#4764403...

View Article



Image may be NSFW.
Clik here to view.

For loop through an associative array

To go through an associative array or object, you could use: <script type='text/javascript'> /* <![CDATA[ */ var data = {}; data['var1'] = 'value1'; data['var2'] = 'value2'; data['var3'] =...

View Article

Image may be NSFW.
Clik here to view.

Bind event to element in jQuery

To bind any event to element (for ex. textarea) use next code: $(document).ready(function() { var prevValue = $("#some_id").val(); $("#some_id").bind('change click keyup', function(e){...

View Article

Image may be NSFW.
Clik here to view.

Overriding methods in Javascript

To override any method in JS+jQuery, use: $(function(){ SomeObject.prototype.someMethodName = function() { alert('Is overriden !!!'); } }); Ex is...

View Article

Image may be NSFW.
Clik here to view.

Get cursor position in textarea or input with JQuery

The next snippet is a JQuery function helps to obtain the posiion of cursor in any HTML input element: (function($, undefined) { $.fn.getCursorPosition = function() { var el = $(this).get(0); var pos...

View Article


Image may be NSFW.
Clik here to view.

Application configuration in AngularJS

If you are developing angular web-application, you ask how to involve configuration in it. I propose next pattern: create constant service and inject it in your other modules, services etc. About...

View Article

Image may be NSFW.
Clik here to view.

OWL Carousel integration with AngularJS

To up to work owl carousel (or other jQuery plugin) with AngularJS you need to perform some actions. 1. Download and include all plugin files: <html> <head> <link href="css/style.css"...

View Article

Image may be NSFW.
Clik here to view.

Sticky header with CSS and JavaScript

Before scroll: After scroll: To obtain of sticky header effect you can use next code snippet. 1. Add CSS styles: .persist_header_container { } .persist_header { padding: 10px; background: yellow;...

View Article


Image may be NSFW.
Clik here to view.

Check is jQuery loaded

The simplest way to check jQuery library exists and loaded on page is next: if (window.jQuery) { // your jQuery code here... } Thanx to http://stackoverflow.com/a/24284903

View Article


Image may be NSFW.
Clik here to view.

Insert Javascript code in JSF page

Usually you may need to insert a couple of JavaScript in your JSF page markup. The following advice helps you do it right:  <ui:composition ...>          <ui:define name="body">...

View Article
Browsing latest articles
Browse All 10 View Live




Latest Images