Passing null as a param for replace() in javascript behaving weird?
- by Babiker
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 between null and ""?
Thanks in advance.