Welcome Guest [Log In] [Register]
We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Some help with basic jQuery
Topic Started: Aug 5 2009, 01:46 PM (256 Views)
ZapTap
Want to talk? My inbox is always open :D
[ *  *  *  * ]
I want to move the #top_info and #top_menu bits into separate divs, called #links_info and #links_menu. What commands would I use to do this in jquery? And also, what does innerhtml.match do (an example would be best).

EDIT: It seems this belongs in coding support. If so, then could a staff member please move it there?

Thanks a bunch,
//ZT\\
Edited by ZapTap, Aug 5 2009, 01:57 PM.
Offline Profile Quote Post Goto Top
 
Fission
Member Avatar
SRS BSNS
[ *  *  *  *  * ]
For the first one, try this:

Code:
 

<script type="text/javascript">
$("#top_info").appendTo("#links_info");
$("#top_menu").appendTo("#links_menu");
</script>
Offline Profile Quote Post Goto Top
 
ZapTap
Want to talk? My inbox is always open :D
[ *  *  *  * ]
I feel slow now :P I had seen that one before but totally forgotten it! Thanks a bunch!

//ZT\\
Offline Profile Quote Post Goto Top
 
ZapTap
Want to talk? My inbox is always open :D
[ *  *  *  * ]
sorry for the double, better than making a new topic :P

but is it possible to use the .parent function and similar to select a DIV and then give it a class or id so it can be styled in CSS?

EDIT: thanks for moving it :P
Edited by ZapTap, Aug 18 2009, 02:13 PM.
Offline Profile Quote Post Goto Top
 
firestrife2
Member Avatar
sƃuıʞ ɟo poƃ
[ *  * ]
You mean like...

Code
 
$("DIV").addClass("CLASS");
Edited by firestrife2, Aug 18 2009, 03:08 PM.
Offline Profile Quote Post Goto Top
 
ZapTap
Want to talk? My inbox is always open :D
[ *  *  *  * ]
so say I have $("#example").previous(); and that selects something like <div>Text</div> with no class or ID in it. What I want to do is add an ID of newone so that I can go in the CSS and put #newone:first-child and edit stuff inside of it

better yet, is there a way to select the first child element of #newone in the same command?
Offline Profile Quote Post Goto Top
 
firestrife2
Member Avatar
sƃuıʞ ɟo poƃ
[ *  * ]
I thought you were asking for a class...Well you can add any attribute like this:
Code
 
$('#ID OR WHATEVER YOU WANT').attr('id', 'IDNAME');


That what you want? Or you could put whatever you need in front, and just add this at the end:
code
 
.attr('id', 'IDNAME');


Offline Profile Quote Post Goto Top
 
Reid.
C'est un piège!
[ *  *  * ]
I would suggest googling a good tutorial on the DOM (document object model) and then going from there. Also, jQuery's site has some wonderful documentation so I'd also read up on that there.

The DOM is one of the more important parts of javascript as far as most things go, so even if you aren't really interested in learning classic javascript as opposed to jQuery, I'd still try to do that.

Be aware that jQuery simplifies many DOM functions, however, and classic js, character for character, is almost always longer than jQuery. That's just part of life.
Online Profile Quote Post Goto Top
 
ZapTap
Want to talk? My inbox is always open :D
[ *  *  *  * ]
thanks to both of you ;) this will be a great help :D
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Theme & CSS Help · Next Topic »
Add Reply