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 ArticleFor 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 ArticleBind 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 ArticleOverriding methods in Javascript
To override any method in JS+jQuery, use: $(function(){ SomeObject.prototype.someMethodName = function() { alert('Is overriden !!!'); } }); Ex is...
View ArticleGet 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 ArticleApplication 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 ArticleOWL 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 ArticleSticky 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 ArticleCheck 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 ArticleInsert 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
More Pages to Explore .....