In the actual code I'm using, that approach doesn't work, Chuck. I tried it before, but tried it again, just in case, and I get this in the
generated source, instead of id="135". <li id="<script>document.write(gNewStoryID)</script>" { <a id="createNewSectionLINK" class="linkCreateSection link">yes</a> ] create a content section</li> Any reason why it would work in <p id="<script>document.write(gNewStoryID)</script>">xyz</p> and not in the code above? Rick From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Chuck Harmston Sent: Tuesday, April 07, 2009 12:25 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: How do I access global variables for id's, etc.? Heh, duh. <p id="<script>document.write(myGlobalVariable)</script>">xyz</p> That's not best practice, though. You should use DOM scripting to ensure unobtrusive Javascript (see http://www.alistapart.com/articles/behavioralseparation). Chuck Harmston http://chuckharmston.com On Tue, Apr 7, 2009 at 12:09 PM, brian <bally.z...@gmail.com> wrote: I don't think it's the quotes that are the problem. Those are, after all, perfectly legitimate characters within a tag. Now, script tags, OTOH ... Why don't you just use something server-side? On Tue, Apr 7, 2009 at 11:53 AM, Rick Faircloth <r...@whitestonemedia.com> wrote: > I would like to be able to do something as simple as > > <p id="<script>myGlobalVariable</script>">xyz</p>, > > but apparently the "" marks are a problem. > > > > I'm able to output a global variable value like this: > > <p>The value of myGlobalVariable is <script>myGlobalVariable</script>.</p> > > > > Is there some way to use global variable values with an id attribute? > > > > Thanks, > > > > Rick > > > > ---------------------------------------------------------------------------- ----------------------------------------------------------- > > "It has been my experience that most bad government is the result of too > much government." - Thomas Jefferson