Dmitrii Dimandt schrieb:
> Hi all
> 
> I've started collecting some examples I've come across while solving
> problems using jQuery. I guess they could be interesting to the
> community as a whole.
> 
> These (sort of) tricks are available here: http://dmitriid.com/jquery/en/
> 
> I hope to add more examples with time.
> 
> Hopefully, this will be helpful to at least someone :)


A few things I noticed:

* In the first example you're using invalid HTML (apart from the fact 
that it's also div soup). An id is supposed to be unique in a document 
and if you're using the same id more than once, that will most probably 
cause problems and unexpected behaviour. For example will 
document.getElementById('title') only return the first element in the 
source with that id.

* Instead of using correct semantics - you're already talking of headers 
so why don't you use it - you're using divs only.

* Using <br /> to create margins is purely presentational and not any 
better than using font tags or inline styles. It's hard to control 
margins via CSS with these breaks in the way.

Here's more semantic markup I'd use for that:

<ul id="wrapper">
     <li>
         <h2>Title 1</h2>
         <p>Body 1</p>
     </li>
     <li>
         <h2>Title 2</h2>
         <p>Body 2</p>
     </li>
     <li>
         <h2>Title 3</h2>
         <p>Body 3</p>
     </li>
</ul>

The good thing about semantic markup is that you don't need classes or 
id's to separate the elements because you can pick them by type (Using 
div soup naturally results in classitis as well).

You should also add the missing type attribute to your style and script 
elements. As these examples seem to be meant as copy & paste do not let 
the people copy the incorrect markup.

Apart from that, thanks for your efforts of course.


-- Klaus


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to