-
Pet Projects
Tag Archives: Javascript
This is useful if you want to “delete” or “update” multiple rows in a table at the same time. This works like the “Check All Email” in YahooMail. $(document).ready(function() { //check all checkboxes $("#check_all_boxes").click(function() { $(".mycheckbox").each(function(i){ $(this).attr("checked","checked"); }); }); … Continue reading
The scenario: Every time you click on a row, the row highlights. When you click on the highlighted row – remove the highlight. The jQuery / Javascript code: //highligths the clicked row function highlightrow(obj) { if ($(obj).attr("style")==’background-color: rgb(255, 255, 187);’ … Continue reading
Alright, here is a quick example of how to use jQuery to select all of the items in a multiple-option select box. //Javascript part assuming that you have already included jquery.js in your header $(document).ready(function() { $("#select_all_col_managers").click(function() { $("#col_manager_list").each(function(){ $("#col_manager_list … Continue reading
In some cases, you are required to do something (EG: show/hide divs) when a checkbox is clicked. Here is an example using jQuery. First your checkbox will look like this: …html code here… < input name=”myCheckBox” id=”myCheckBox” value=”yes” type=”checkbox” /> … Continue reading
I found this: jRails is a drop-in jQuery replacement for Prototype/script.aculo.us on Rails. Using jRails, you can get all of the same default Rails helpers for javascript functionality using the lighter jQuery library. jRails provides drop-in functionality for these existing … Continue reading
Here is an excerpt from a book – Beginning Ajax with PHP: From Novice to Professional. While the concept of Ajax contains a handy set of functionality for creating actions on the fly, if you are not making use of … Continue reading
Java Passion provides an 18-week AJAX online course for free. I’m not sure if the guy responsible for this was the same guy I saw a couple of years ago in Waterfront Cebu – when I was attending a seminar/conference. … Continue reading
Here is a sample code to detect that a browser is closed or a link has been clicked. This detects if the user is exiting the page. I am using this for locking/unlocking table rows in my database. <script type="text/javascript"> … Continue reading
Here is a quick and simple tutorial to modify table row attributes. The tutorial assumes that you already have a class assigned for the TR tag – let’s say you are trying to do a zebra-style table where each row … Continue reading
I have been using PHP with jQuery so this one caught my attention. It’s easy to get caught up in the dynamic potential of Ajax. But with innumerable possibilities also comes increased risk. If security isn’t a major concern, it … Continue reading