Tuesday, July 28, 2009

[jQuery] Re: changing style attributes.

It is dynamic, yes, but on the server side (mason/perl), so the final
html should have those elements when the page loads in the client. I
found an easier way to do this without JQuery (there were tools
already built in that were easier to use, but not as flexible [usual
trade off, I think]). I will visit this again, maybe in a later
revision. Since I am interested in getting ajax elemetns to work on
the page, maybe when I put in the ajax components would be a good time
to take another look. I will keep your advice in mind.

Thanks,
ooj.

On Jul 25, 9:46 am, Charlie <charlie...@gmail.com> wrote:
> understanding how the basic animations functions in jQuery helps.
> $("#something").show()
> jQuery uses amendments to the element syle attribute to make this happen. So in your example
> $("#this=thing&that=more&bing=bang").show() will override the display:none
> If as you say you are doing this dynamically it's important to understand that if an element is not in existence when document.ready functions fire it has no events tied to ithttp://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_AJAX_request.3F
> Old Orange Juice wrote:OK, been banging my head with this for a while. I have a dynamic site where we get a list of elements from the database, we identify these items with id numbers and encoded get strings. So I'm trying to get style changes to take affect with jquery and it really just doesn't work. I'm not sure what I'm doing wrong. Here is the source code: <html> <head> <script type=text/javascript src=/scripts/jquery-1.3.2.min.js></ script> <script> $(document).ready(function() { $("#this=thing&that=more&bing=bang_anchor").click(function() { //event.preventDefault; $("#this=thing&that=more&bing=bang").attr('style','display: block'); }); }); </script> </head> <body> <a href="#" id='this=thing&that=more&bing=bang_anchor'>Display</a> <div id="this=thing&that=more&bing=bang" style="display: none"> Lorem Ipsum dolor sit amnet. </div> </body> </html> This code is supposed to make the div appear when link is clicked.. Can anyone point out what I'm doing wrong?

No comments: