manhcodedao / jquery-watermark

Automatically exported from code.google.com/p/jquery-watermark
0 stars 0 forks source link

$.watermark.hideAll() gives IE6 JavaScript error cause by selWatermarkAble #32

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In my click event function attached to the form submit button, I'm using 
"$.watermark.hideAll()" to do some other work on the form. After testing all 
other browser successfully, I found IE6 was producing a weird error while 
submitting the form. After hours of searching, I found the code that cause the 
weird error and fixed it by modifying the value in the "selWatermarkAble" 
variable inside the Watermark plugin, the JavaScript source code file. I'm 
still not sure why only IE6 is producing a weird error cause by the value set 
in the jQuery selector. I'm using jQuery 1.4.2 and Watermark 3.0.6 JavaScript 
libraries.

Error:
1. Use code "$.watermark.hideAll();".
2. Run code using IE6 Browser.
3. Get JavaScript error: "Error on page." Upon opening the dialog: "Error: 
Failed"

Solution:
I was able to trace the error in the "jquery.watermark.js" file to line 
"$(selector).filter(selWatermarkDefined).each("

I fixed the error by replacing the value in the "selWatermarkAble" variable 
from ":text,:password,:search,textarea" to "input:text".

Remark:
The selector "textarea" and ":password" are not needed because the selector 
"input:text" does it already. The selector ":search" does not exist in the 
jQuery API (http://api.jquery.com/category/selectors/form-selectors/).

William Chang
http://www.williamchang.org

Original issue reported on code.google.com by diehardboss@gmail.com on 15 Sep 2010 at 6:59

GoogleCodeExporter commented 8 years ago
The :search selector is defined by the plugin, not by jQuery.  Look at lines 
64-66 in the code.

Many of the things being done with the selectors are to support many other 
browsers, so you can't rip them out and expect your site to work correctly in 
other browsers.  (And other browser versions.)

If you have a test page online for the IE6 issue you are experiencing, I can 
take a look.  That is a must, because most reported errors are actually caused 
by the plugin being use incorrectly or have simple solutions that do not 
involve changing the code.

Original comment by t...@speednet.biz on 25 Sep 2010 at 3:08

GoogleCodeExporter commented 8 years ago
Because of time constraints, I could not isolate the problem from everything. 
It could be markup error or something else, but I did remove all other 
JavaScript dependency to only jQuery and Watermark.

I will revisit this issue and make a test page to see where the issue is 
occurring.

Original comment by diehardboss@gmail.com on 27 Sep 2010 at 1:43

GoogleCodeExporter commented 8 years ago

Original comment by t...@speednet.biz on 3 Dec 2010 at 2:45