I have a small .get() that receives a block of HTML from a php file (the file renders the code so that it will pass as plain HTML). All of the code is coming in, but it isn’t behaving as I had expected.
I’m using Yahoo Tabview, and if I copy and paste the same HTML code into the HTML section of my .html file, everything is shows up and tabs correctly, but when I bring it in through the .get() function all the code is applied to every tab’s content area.
Here’s my .get() function:
$.get('index.php', function (serverResponse) {
$('.yui-content').append(serverResponse);
});
Does jQuery add anything to the code or cause it to act differently that if you copy-and-paste it into the file?
Let me know if I need to include any other code…
The problem is because you are using a class selector – which I assume is on more than one element. I can’t give you a definitive answer without seeing your HTML, but if you change the jQuery
append()to use an Id selector (example below), it should work correctly.