Empty textfield using jquery?

Empty textfield using jquery?

Hi,

I have 2 questions:
----------------------------------------------------------------------------------------------------
QUESTION 1:

I have a function that is supposed to empty the textfield when "onfocus" if the value is the defined "ValueToCheck" like this:

function removetext(strElement,ValueToCheck) {  
   if (document.getElementById(strElement).value == ValueToCheck) {
    document.getElementById(strElement).value = "";
    }
}

I call it onfocus from an input field from another file(index.html) like this:

<input name="test" id="test" class="text" type="text" Value="write here"
onfocus="removetext(this.id,'write here');">

This works. But my problem is that I can not get this function working using jquery?

I have tried this:

function removetext(strElement,ValueToCheck){
if ($('strElement').val(ValueToCheck)){
$(strElement).val('');
}

<!-- @index.html -->
<input name="test" id="test" class="text" type="text" Value="write here"
onfocus="removetext(this,'write here');">

It does actually remove the text when the input field is focused, but it empties the field also when it is not supposed to (When the text on the field is something else than ValueToCheck (In this case "write here") ?
It is only supposed to empty the field if the value is the defined "ValueToCheck".

I also tried this:

function removetext(strElement,ValueToCheck){
if ($('strElement').val == ValueToCheck){
$(strElement).val('');
}

Does not work...?
Thanks for all answers!

-------------------------------------------------------------------------------------------------------------
QUESTION 2:

I have wrapped most of my jquery to an external script.js file inside
$("document").ready(function() {     all jquery script        });

However there are functions that i need to call from the index.html file. These functions do not appear to
work from another file unless they are written outside the:
$("document").ready(function() {     all jquery script        });             function(){ functionstuff  };


Why is this?
What exactly does $("document").ready(function() { }); do?   

Thank you!