Hi,
Yesterday I ran into problems with colliding namespaces on a project
I'm working on, so I decided that while I was getting organised I'd
try out a js library, and choose jquery. I think I made the right
choice, but some of my scripts now do nothing in IE while still
working in firefox.

One of the scripts that doesn't work is very simple, so I'll provide
it as an example:

// select all checkboxes, add a "select all" button to buttons div
// using standard js:
$(document).ready(function() {
  //alert($("div.buttons").length);
  // a function to set all checkboxes to true in a form
  var select_all = function() {
    $(this)
    .parents("form")
    .find("input:checkbox")
    .attr("checked", true);
    //      alert($(this));
    return false;
  };

  // add a button to call select_all on click
  $('<input type="button" name="select_all" value="Select All" />')
    .click(select_all)
    .appendTo($("div.buttons"));
});

That's it, hopefully a more experienced jquery user can spot any
mistakes that might be there. Neither IE 6 nor 7 even alerts $
("div.buttons").length, btw.
It could be something unrelated to jquery, but as this is the first
time I've used it, I thought I'd check.

Thanks,
Jez Austin.

Reply via email to