Load html page using jquery and select element from it
I am having a problem selecting an element from a previously loaded html page
if i use this code, the one that was last is denoted also the last one in the dom-tree instead of the one i just pasted
$("div.wrapper:last").after('<div class="wrapper"></div>');
$('.wrapper:last').load('tbnote.html .pane');
$(".pane:last").prepend("testmessage");
What can I do make it work too, because I also need to set the value of the hidden field as the main value of the database table
if this is not possible, what would be an alternative to get the content in a div with already specified hidden margins values?
Thanks in advance Richard
Try the following:
$('.wrapper:last').load('tbnote.html .pane', function() {
$(".pane:last").prepend("testmessage");});
I'm not sure what you really want to achieve, but a common mistake among developers new to jQuery is considering ajax functions to execute instantly. In contrast, the loading of the remote html will happen asynchronously and you need to use an additional callback function.
a source to share