Change cursor to wait while loading a content, after, chage cursor to default when loading content is finished.
Hi all, as the tittle says, I want to change the mouse pointer to diferent images, something like:
- $('#searchFor').keypress(function(e) {
- code= (e.keyCode ? e.keyCode : e.which);
- var nombreServer = $('#searchFor').attr('value');
- if (code == 13) {
- $(this).css('cursor','progress');
- $('#muestraListadoServers').load('mostrarServer.php',{sname: nombreServer});
- $(this).css('cursor','default');
- }
- });
Of course I know it doesn't work this way, but it is a graphic way to explain it.
I tried for example:
- $('#searchFor').keypress(function(e) {
- code= (e.keyCode ? e.keyCode : e.which);
- var nombreServer = $('#searchFor').attr('value');
- if (code == 13) {
- $('#muestraListadoServers').load('mostrarServer.php',{sname: nombreServer});
- $('#muestraListadoServers').ready (function() {$(this).css('cursor','progress');});
- }
- });
Thinking "When dom is loading, shows pointer like progress". But it doen't run, nothing happens.
Also I was thinking on a calling back, but I'm not sure about it is well done, because, it doesn't run, nothing happens:
- ...
- if (code == 13) {
- $('#muestraListadoServers').load('mostrarServer.php',{sname: nombreServer},function() {$(this).css('cursor','progress');} );
- }
- ...
I try make a textbox like a "<a href" behaviour, changing css cursor by differents actions.
This is the full code:
- $().ready(function() {
- $('#searchFor').autocomplete({source:'printNameServers.php', minLength:2});
- $('#searchFor').keypress(function(e) {
- code= (e.keyCode ? e.keyCode : e.which);
- var nombreServer = $('#searchFor').attr('value');
- if (code == 13) {
- $('#muestraListadoServers').load('mostrarServer.php',{sname: nombreServer});
- }
- });
- });
I appreciate any help, thank you.