CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript frameworks (http://www.codingforums.com/forumdisplay.php?f=62)
-   -   Resolved .class is not a function (http://www.codingforums.com/showthread.php?t=275338)

WolfShade 10-05-2012 05:29 PM

.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,

WolfShade 10-05-2012 06:04 PM

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);


DanInMa 10-05-2012 06:06 PM

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();

WolfShade 10-05-2012 06:22 PM

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. :)


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

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.