I am trying to find a fallback solution for browsers who do not interpret the placeholder attribute for input elements. I have this simple jQuery Script but it throws an Err
I have just fixed a similar problem in my project. It turned out that I was trying to set a value of a <input type="file" ...>
input. It seems that you may be facing the same problem, because you are selecting all inputs of a document regardless of their type.
If you have firebug installed, try looking for the input that causes this error by inserting a log
command before trying to modify the input's value.
$('document').ready(function(){
$('input').each(function() {
if ($(this).val() === '' || $(this).val() === undefined) {
// Log goes here
window.console.log(
'There is an input without a value!',
this);
$(this).val($(this).attr('placeholder'));
}
});
});
I had an insecure warning in conjunction with antoher function. The reason there simply was, that a library function was called with an array given as parameter, but it expected an element (dom). The result was the expected, but I'm sure, this won't be in any case. So check if the types of your variables are the one you (or the other side) want's it to.