Hi all,
I've got some trouble with JQuery script on my Asp.net page. During first load it works well, after postback it does not. Initiali I thought that it is because script is not load again, but alert told me that script runs as I use function pageLoad() instead of $(document).ready(function().
In script I just read value from one textarea and set the lenght value to next text input. I am putting script into page like this:
<script type="text/javascript" src="../js/smsanywhere.js"></script>
I tried to place directly into page, but there is no difference I guess.
The script is shown below.
function pageLoad()
{
alert('pageLoad is there');
var textBox = "textarea[id*='txtMessage']";
var counterBox = "input[id*='txtCharLeft']";
$(textBox).keydown(function(){
alert(this);
var length = 70 - $(this).val().length;
$(counterBox).val(length);
$(counterBox).attr("style",function(){
return "width:30px;" + (length < 0 ? "background-color:Red;" : "");
});
});
}
I dont use any ajax at this page, its just master page , content page and jquery.
What am I missing...