A web developer's blog. PHP, MySQL, CakePHP, Zend Framework, Wordpress, Code Igniter, Django, Python, CSS, Javascript, jQuery, Knockout.js, and other web development topics.

Tag Archives: Javascript

Check Multiple Checkboxes in one click using jQuery

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

Posted in General | Tagged , | Leave a comment

Hightlight a table row on click using jQuery

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

Posted in General | Tagged , , | 4 Comments

jQuery: Select all options in a Multiple-option Select Box

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

Posted in General | Tagged , , | 16 Comments

Handling HTML Checkboxes. Execute something when checked/unchecked.

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

Posted in General | Tagged , | Leave a comment

jQuery on Ruby on Rails

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

Posted in General | Tagged , , , | Leave a comment

AJAX and PHP

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

Posted in General | Tagged , , | 2 Comments

Free AJAX Training – 18-week Online Course

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

Posted in General | Tagged , , , , | Leave a comment

Detect browser close / page exit using Javascript

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

Posted in General | Tagged , | 5 Comments

Modifying table row attributes using Javascript

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

Posted in General | Tagged | Leave a comment

PHP + AJAX Security Issues

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

Posted in Uncategorized | Tagged , , | Leave a comment