I have the following code-
<script type="text/javascript">
$(document).ready(function() {
$("#clanname").keyup(function(e) {
var clanname = $(this).val();
if (clanname.length < 4) {
$("#user-result").html('');
return;
}
if (clanname.length >= 4) {
$("#user-result").html('<img src="images/ajax-loader.gif" />');
$.get('getClanName', {clanname:clanname}, function(data) {
if(data=='free')
{
$("#user-result").html('<img src="images/available.png" />');
}else{
$("#user-result").html('<img src="images/not-available.png" />');
}
});
}
});
});
</script>
which I put in the head section of my php file, but I want to put this in a seperate .js file and want to call this code on the text changed event of my textbox.and I want to make it parameterized function and want to pass the textbox's text to that function Can somene please suggest me how to to this.