Basically, a layout wraps various snipits of html body-element code
with a constant-content wrapper. Accordingly, it is the layout that
contains the html element associated with the respective
snipits and the element is the same for all such snipits. I
seem to be encountering a variety of cases where I would like to have
specific javascript code and/or styles (which I would ordinarily place
in the html element) apply only to one specific html snipit of
many such snipits that share a common element. I am wondering
how others are approaching this situation. Thanks for any input.
Basically, a layout wraps various snipits of html body-element code
with a constant-content wrapper. Accordingly, it is the layout that
contains the html element associated with the respective
snipits and the element is the same for all such snipits. I
seem to be encountering a variety of cases where I would like to have
specific javascript code and/or styles (which I would ordinarily place
in the html element) apply only to one specific html snipit of
many such snipits that share a common element. I am wondering
how others are approaching this situation. Thanks for any input.
I was so lucky with the answer to my first question that I thought I
would press further into a related aspect that is also troubling me.
I often want to launch a JavaScript when a particular page loads. The
typical way that I do this is by including an onload event handler in
the opening tag for the page. If the particular page in
question happens to be formed by embedding a snippet of html code in a
layout there may be a problem in that the body tag is typically in the
layout and therefore shared with other pages similarly formed and for
which I do not want to launch the JavaScript. Anyone have a good way
of handling this?
Thanks.
... doug
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.