In my opinion, if you control the server side code, it's always best to do it there, rather than depend on jQuery for that. For several reasons.
1) Since PHP has to write the code anyway, tacking an extra few chars is no big deal 2) Users without JS will see the correct version. 3) No need to maintain two separate sets of code. andy -----Original Message----- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Pkunzipula Sent: Thursday, June 25, 2009 2:16 PM To: jQuery (English) Subject: [jQuery] The Balance between PHP and JQuery Hello Everyone! I am new to both PHP and JQuery, and I am running into conflict over which language is right for which task. For instance: I have a simple content management system (PHP) which allows administrators to add and update stories with a textarea form. I then use PHP to retrieve the input from the textarea, find the new line breaks and convert them to <p></p> tags. It works. I then use the JQuery selector $('#slide div p:first').addClass ('noIndent') to take indenting off the first paragraph of each story where #slide and div are both hard-coded into the HTML, but the p is generated by PHP. It doesn't work. Is it my syntax, or do I really have to use PHP to generate the classes too? Or do I need to back it up and use JQuery instead to output the <p></p> tags? I appreciate any effort to clarify this matter, and in the process, could you give me some simple guidelines of where you draw the line between PHP and JQuery? Thanks for your time! Arlen