I have the follwing jQuery:
$("#textArea").keyup(function(){
var textAreaValue = $("textArea");
if(!textArea.value.indexOf("some string")){
textArea.value = textArea.value.replace("some string",null);
alert("It was there!");
}
});
-
Is it normal for
element.value.replace("some string",null);to replace"some string"with"null"as a string? And if normal can you please explain why? -
I have tested it with
element.value.replace("some string",""), and that works fine, so what would be the difference betweennulland""?
Using FireFox 3.6.3, Thanks in advance.
Seems like null has been type-casted to a String.
Try:
Although you can’t call toString() on a
nullobject, it seems the null object is implicitly being converted to a String, which gives the string"null".