...

View Full Version : end tag for "ul" which is not finished



amaze646
11-05-2010, 06:16 PM
I know! There is no li tags in my list so I get this error. But here is the thing. I have horisontal quick gallery on my site. It is a jquery plugin named jCarusel. This code fills images in li tags. So, this all work perfectly fine but I can't validate my page becouse it sais that ul is not finished. When I check source code of my page I only see:


<ul id="mycarousel" class="jcarousel-skin-moja">


</ul>

If I check with firebug than I can see that li elements are there. I tryed to add one li tag before I call function to generate images, but then no images shows. How can I add li tag so that the browser, validator will see li inside ul. As I said, if I add li in ul before I call function for pictures, I get no results.

This is plugin that I use. I can see that the same error occures when I validate this page.
http://sorgalla.com/projects/jcarousel/examples/dynamic_ajax_php.html


Thank you


<div id="quickGallery">
<ul id="mycarousel" class="jcarousel-skin-moja">
<?php
//Preverimo ali je morda prikazana galerija. Ce je prikazana galerija, potem odstranimo hitro galerijo.
function wt_get_ID_by_page_name($page_name)
{
global $wpdb;
$page_name_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '".$page_name."'");
return $page_name_id;
}

global $post;
$id = $post->ID;
$id_gallery = wt_get_ID_by_page_name('Galerije');
trim($id_gallery);
if($id != $id_gallery)
{
// content of picture slider goes here
}
?>

</ul>
</div>

digitalclubb
11-05-2010, 06:20 PM
So are you generating the list items via php? If so why not generate the UL container also inside the php before the list items are embed.

That way your browser will just see the empty div on the document load.

If its the carousel thats creating the list items, can't you modify it to specify the containing div and not the UL?

DrDOS
11-05-2010, 06:27 PM
After the page has loaded in Firefox right click the body of the page and choose 'select all', right click again, choose 'view selected source', then right click the source code and choose 'select all' again, then 'copy', and paste that code into the Validator text field, you will need to paste the Doctype statement at the top of the Validator field too, as it gets removed in the first process. It's tedious but it will allow you to fully validate a page written by javascript.

digitalclubb
11-05-2010, 06:34 PM
But viewing the generated source contains the list items required to clear out the error you have specified..

Your problem seems that you are embedding the UL then using the carousel plug-in.

Set the carousel on the Div and this will embed the UL and LI needed and not contain any validation errors?

amaze646
11-05-2010, 06:57 PM
No, this php code is just checking which page is displayed and if a gallery page is displayed then quick gallery is not shown. Pictures are generated via javascript. Here you can see what I mean. (http://dev.mazej.net/) If you click on Galerija than you will notice that image slider is not shown.
So are you generating the list items via php? If so why not generate the UL container also inside the php before the list items are embed.

That way your browser will just see the empty div on the document load.

If its the carousel thats creating the list items, can't you modify it to specify the containing div and not the UL?

amaze646
11-05-2010, 07:11 PM
Ok guys, thank you all. I fixed the problem. I replaced all ul and li tags with div and assign the same class to divs. So now there is no more error.

Best regards!

Apostropartheid
11-06-2010, 01:17 AM
Ok guys, thank you all. I fixed the problem. I replaced all ul and li tags with div and assign the same class to divs. So now there is no more error.

Best regards!

For future reference, the reason the error occured was because UL elements must contain at least one child.

teedoff
11-06-2010, 04:43 AM
For future reference, the reason the error occured was because UL elements must contain at least one child.

This was brought up in another post of the OP.

Glad you got it working!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum