How can I refresh or reload the state of a jQuery Object? I did some research and found these answers, but they no longer work due to a property deprecation:
How can I refresh a stored and snapshotted jquery selector variable
This worked based on this https://api.jquery.com/selector/, but it'll be removed as of jQuery 3.
how to refresh objects when i modify the HTML in jquery?
This has some related title, but it's not what I'm looking for.
These are some tests I've been doing:
//Old working solution
$.fn.refresh = function() {
return $(this.selector);
};
$.fn.refresh = function() {
var curr = $(this);
window.console.log(this);
//window.console.log(curr);
//window.console.log(curr[0]);
//return $(this);
if(curr.length < 1)
return $();
curr = $(curr[0]);
if(curr.prop('id') != '')
return $('#' + curr.prop('id'));
if(curr.prop('name') != '')
return $('name=["' + curr.prop('name') + '"]');
};
Aucun commentaire:
Enregistrer un commentaire