/    Sign up×
Community /Pin to ProfileBookmark

weird div/table spacing problem

Short n simple: I’m using AJAX, php, java.

I Have a DIV.
I Insert info into this DIV via ajax.

To be specific a table: <table><tr><td> << </td></tr></table>

So it looks like this:

<DIV>
<table><tr><td> << </td></tr></table>
</DIV>

The problem? When I load a new table: <table><tr><td> hi friend! </td></tr></table>

into the DIV, there is a very annoying space that comes up. See image below:

[IMG]http://img201.imageshack.us/img201/8425/wiersd.jpg[/IMG]

Right. As you see theres a DIV and a TABLE. THEN theres this: “”

WHY is this “” there.

When I just insert text: hi friend
without the table, td, and tr. it works.

So it must resolve around me inserting a table into the div.

Any pointers/help? Driving me bonkers!

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@eval_BadCode_Feb 05.2011 — There could be a lot of reasons.

I like firebug, but sometimes you really need to view the real source code to get a better idea. I've noticed that firebug sometimes is forced to make a "best guess" when the alternative is to not load anything past a certain point in your html.

You may also (if you haven't already) want to use htmlentities() on your output, one reason this may happen is because you are doing something like this:

[code=php]
<div><table><tr><td>

<?php echo "<<< " ' / > /> </td>"; ?>

</td></tr></table></div>
[/code]


It's probably not that extreme, but you see what I'm getting at.

The big culprit (from my experience), is when you are writing a string into an html field such as "class", "ID", "onmouseover", etc. and the string you write contains a quote also. This is actually exactly what it looks like to me, the << may be from elements which tried to close but could not find an opening tag.

Edit:

This has nothing to do with your problem. You may also want to type <div> in lowercase.
Copy linkTweet thisAlerts:
@itsalloverauthorFeb 05.2011 — Hi! Thanks for your reply! And thnk you I totally forgot about firefix. however.

I did try it. and It's exactly the same. THough now you donät even see the "" you see an empty space.

As for the php. I've taken all php out. And just have: hi freind

Instead. [B]WEIRD thing is is that when the page loads it works, its when ajax injects new html int othe div it starts going funky.[/B]
Copy linkTweet thisAlerts:
@eval_BadCode_Feb 05.2011 — Run it through an xhtml validator.

Post the source + ajax. Are you using innerHTML or replacing the entire tag? etc etc... so many questions. Does your ajax populate the table/div using a PHP script? Have you tried requesting the ajax data directly-- if so what's the output?

Pretty common debugging things... But yeah I know what you mean, I've had a couple of FireBug double quotes of death.
×

Success!

Help @itsallover spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...