jQuery .submit() trigger problem

Recently I experience the following problem, when I call this code it triggers an error in FireBug:

$('input[name="s"]').parents('form').submit();

With “human” words: I trired to find a input with a spefic name, then find the form wrapping this input and try to submit it. Strangely, but it trows an error in jQuery lib.
Continue reading

Share it:
  • Facebook
  • Twitter
  • Digg
  • StumbleUpon
  • del.icio.us
  • Google Bookmarks
  • Yahoo! Buzz
  • Add to favorites
  • Identi.ca

Script tag and attributes

I’ve lost precious time wondering why a Javascript code is working properly in FireFox, while on IE it’s not working at all. First thought was that the script is incompatible, but the final result was pretty stupid.

The reason:
The script tag was written this way:

<script type="application/x-javascript">
....
</script>

changing the type attribute to “text/javascript” do the magic:

<script type="text/javascript">
....
</script>

The first code is created from autocomplete snipped in Komodo Editor. So, use “text/javascript” type attribute in order to reduce headaches 🙂

Share it:
  • Facebook
  • Twitter
  • Digg
  • StumbleUpon
  • del.icio.us
  • Google Bookmarks
  • Yahoo! Buzz
  • Add to favorites
  • Identi.ca