Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-05-2012, 05:29 PM   PM User | #1
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 941
Thanks: 7
Thanked 95 Times in 95 Posts
WolfShade is an unknown quantity at this point
.class is not a function

Hello, everyone.

I'm trying to change the content of a div (no ID, but it does have a class) contained within another div (has ID and class). I'm getting two errors - "class is not a function" and "html is not a function".

This is utilizing the jQuery 1.7.2 library.

Here is the code I'm trying to write:

Code:
<div class="classA" id="ID_#cf variable#">// There are several rows, each with unique IDs that begin with "ID_" //
  <div class="classB"> content 1</div>
  <div class="classC"> content 2</div>
  <div class="classD"> content 3</div>
</div>
Code:
var targetID = $('.rowFocus').attr('id);
targetID = document.getElementById(targetID);
var stuff = targetID.class('.classD').html();
alert(stuff);
What am I missing?

Thank you,
__________________
^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
*
The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

Last edited by WolfShade; 10-05-2012 at 06:04 PM..
WolfShade is offline   Reply With Quote
Old 10-05-2012, 06:04 PM   PM User | #2
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 941
Thanks: 7
Thanked 95 Times in 95 Posts
WolfShade is an unknown quantity at this point
Damn.. I spent a lot of time playing with this before posting my question. Suddenly, after posting it, I have resolved it. (sigh)

Code:
var newVar = "A string of new text";
var targetID = $('.rowFocus');
var childs = targetID.children('classD');
childs.html(newVar);
__________________
^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
*
The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".
WolfShade is offline   Reply With Quote
Old 10-05-2012, 06:06 PM   PM User | #3
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
Im a little confused by your explanation, where does .rowfocus come into play?

Im guessing somehting like this?

Code:
var stuff = targetID.find('.classD').html();
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is online now   Reply With Quote
Old 10-05-2012, 06:22 PM   PM User | #4
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 941
Thanks: 7
Thanked 95 Times in 95 Posts
WolfShade is an unknown quantity at this point
rowFocus is a highlighted row that contains order status, customer, website (when clicked, it highlights and grabs data from the database to display in an editable form.)

I was trying to set it so that when one field in the form was changed (website), it would automatically update the database AND change the website in the list. It's working.
__________________
^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
*
The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".
WolfShade is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:19 PM.


Advertisement
Log in to turn off these ads.