I have never been interested in reading jQuery, so I just stuck with my poor javascript. I wanted to try it when I was writing a function today, but when I used bind to register events, I found that it didn’t work.
$("#txtStation").bind("onpropertychange", GetStationLevel);
Then I tried onclick and the like, but none of them worked. I had no choice but to look through jQuery’s API. I couldn’t understand the details of the jQuery API, but I found that the bind registration event was not on. of.
Found a change event, tried it
$ ("#txtStation").change(function(){alert('change')});
I found that it will not activate until the focus is lost, just like onchange. I can't use it.
With the idea of giving it a try, I deleted the on in front of onpropertychange. Anyway, it doesn’t matter whether the html itself supports the event or not, as long as you write it, it will probably work. I didn't expect it to work. There is no problem with IE. Now we are not talking about cross-browser. We have to be able to use it under Firefox.
People in Firefox say to use the oninput event. I tried it but it didn’t work. Oninput will only be activated when a value is entered. My input box is sensor-based, which means that when you input a word, it starts with this word. You can choose which one is sensed. If you select the sensed item, oninput will not be activated.
I haven’t thought of any good solution for the moment. Now I have added a browser to register the blur event if it determines that it is not IE. The problem is that when blur is the active focus of other controls, the txtStation control registration method is to Fill in a drop-down list next to it, so that blur is triggered only when the drop-down list is selected after writing the content of txtStation. There is a second refresh, which has no big impact, but the user's first click is invalid. If anyone has a good method, please tell me.
Code
if($.browser .msie)
{
$("#<%=txtStation.TextBoxID%>").bind("propertychange", GetStationLevel);
}
else
{
$("#<%=txtStation.TextBoxID%>").bind("blur", GetStationLevel)
}
Looking at the front, it seems that there is nothing written in the title. Quite impressive, haha. I write it down because I’m afraid I’ll forget it.