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: jquery

Mixing PHP Variables with Javascript (Zend Framework and jQuery)

Sometimes, I “mix” PHP variables with Javascript. For example, I have something like this: function deletenote(notes_id) { if(!confirm("Delete note? You will not be able to undo this action.")) return false;   $.post("< ?=$this->baseUrl?>/notes/deletenote",{ skeedl_notes_id: notes_id }, function(data){ $(’#notes_id’+data).fadeOut(); }); } … Continue reading

Posted in General | Tagged , , , | 7 Comments

Get name of textarea or input using jQuery

You can do this in jQuery: $("textarea[@name=my_field_name]").val();$("input[@name=my_field_name]").val() Update, the @ is now deprecated. I remember using VisualjQuery and the filters do not have an @… $("textarea[name=my_field_name]").val(); Thanks to Simon…

Posted in General | Tagged , | 4 Comments

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

jQuery AJAX in Zend Framework

I have posted a sample code on my wiki on how to submit variables to an action controller. The sample code contains a niffty jQuery plugin – the jQuery Calendar. Click here for the tutorial. Update (07-08-2008): For those who … Continue reading

Posted in General | Tagged , , | 6 Comments