How to get full path of selected file on change of using javascript, jquery-ajax? – Stack Overflow

$(‘#i_file’).change( function(event) { var tmppath = URL.createObjectURL([0]); $(“img”).fadeIn(“fast”).attr(‘src’,URL.createObjectURL([0])); $(“#disp_tmp_path”).html(“Temporary Path(Copy it and try pasting it in browser address bar) –> [“+tmppath+”]”);});

Source: How to get full path of selected file on change of using javascript, jquery-ajax? – Stack Overflow

The ugly way to get twitter bootstrap in spring MVC

Ok, I know maven is great, but I am not able to work with it! You may call me a noob in spring and Java EE so it may be possible that I am not getting it properly, but here is an ugly way to enhance my page with bootstrap.

In servlet-context.xml, make sure this line exist

<resources mapping="/resources/**" location="/resources/" />

If it is already inside that xml file, you are lucky like me. Now download twitter bootstrap and put them in resources folder of your webapp folder.

if you have done it, then you can get bootstrap in your web view. try this

<script src="<c:url value="/resources/js/jquery.js" />"></script>
<script src="<c:url value="/resources/js/bootstrap.min.js" />"></script>
<link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/bootstrap.min.css" />" />

And then, do your design.

BTW, did i mention that you will need jquery to use bootstrap?

checking a checkbox in jquery

for JQuery 1.6+

$('.myCheckbox').prop('checked', true);
$('.myCheckbox').prop('checked', false);

for below 1.6

$('.myCheckbox').attr('checked', true);
$('.myCheckbox').attr('checked', false);

jquery-textfill/jquery-textfill · GitHub

jQuery TextFill resizes text to fit into a container and makes font size as big as possible.

This jQuery plugin was created by Russ Painter around May 2009, beginning with a StackOverflow question. In very early 2012, Yu-Jie Lin helped to move the project to GitHub with version 0.1 and obtained the clearly stated open source licensing from Russ.

via jquery-textfill/jquery-textfill · GitHub.

datepicker onchangemonthyear example (jquery UI)





jQuery onScrollBeyond and scrollExtend plugins

The scrollExtend plugin is designed to automatically load new content at the bottom of the screen (by appending to a DOM element) when the user scrolls beyond the element, much like Facebook does with their status updates. The existing infinite scroll plugin was primarily designed to integrate with WordPress, which didn’t really suit my purposes.

There are two plugins encapsulated here – onScrollBeyond, which allows the developer to specify a callback to be run when an element is scrolled beyond (or the end of the document is reached), and scrollExtend, which is simply an implementation of onScrollBeyond that automatically loads new content via ajax when a user scrolls past an element.

Works with jQuery 1.3.2 and jQuery 1.4.2

Tested in IE6, IE7, Firefox, Chrome, Safari

Update v1.0.1 – fixed scrollExtend would get stuck in a disabled state if beforeStart returned false, even if it returned true on subsequent calls

– See more at:

here how i used this,

limit = 10;
 page = 0;

 $.post("tsz_analytics_controller.php?c=fetchCustomerInfo&venueId=<?php echo $_GET['venueId'] ?>&limit=" + limit + "&page=" + (page) + "", function(data) {



 Load a JavaScript file from the server using a GET HTTP request, then execute it.


$.getScript('ajax/test.js', function() {
    alert('Load was performed.');

Implementing jquery mobile in express js application with jade template

in layout.jade view file

doctype 5
                 title= "MyMobileApp"
                 link(rel='stylesheet', href='/stylesheets/style.css')
                 link(rel='stylesheet', href='/stylesheets/')
                 <meta name="viewport" content="width=device-width, initial-scale=1">
         body(class="ui-mobile-viewport ui-overlay-c")
                 div(data-role='header',class='ui-header ui-bar-b')
                                   p My Sample Application
                          block content
                 div(data-role='footer',class='ui-header ui-bar-b')
                          h4= "Page Footer"

now, in index.jade view file,

extends layout

block content
p page content goes here

careful on indenting. jade template reacts the most with indentation.

Manipulating checked box using jquery

$('#alldays').attr('checked','true'); // make the checked box true
 $('#alldaysAnyTime').attr('checked','true'); // another one example

JQuery.trim() by example

<!DOCTYPE html>
<script src=""></script>
<pre id="original"></pre>
<pre id="trimmed"></pre>
var str = " lots of spaces before and after ";
$("#original").html("Original String: '" + str + "'");
$("#trimmed").html("$.trim()'ed: '" + $.trim(str) + "'");
the syntax is $.trim(str)