Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Tuesday, June 17, 2014

Javascript: force client to reload javascript files

Ctrl+F5

or add a version information in file specification, and change it every time the js file is updated

<script type="text/javascript" src="file.js?1.1"></script>

Sunday, May 19, 2013

How to find id of enclosing tr

var myId = $(this).closest('tr').attr('id');

How to post without redirecting / reloading the page

$.post(action, $('#MY_FORM').serialize());

How to deal with dots in HTML id

/* "." and ":" are problematic within the context of a jQuery selector
 * because they indicate a pseudo-class and class, respectively */
myId = myId.replace(/(:|\.)/g, "\\$1");

Thursday, January 19, 2012

Testing your css or javascript code

  1. Go to JSFiddle.
  2. Put the HTML in the HTML area, the CSS in the CSS area, and the JavaScript in the JavaScript area
  3. Press Run and see if the result is demonstrating the problem, adjust as needed to make the problem very clear.
  4. Press Save to get a public URL.
  5. Share that URL where you are trying to get the troubleshooting help.