Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts

    .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,
    Last edited by WolfShade; 10-05-2012 at 06:04 PM.
    ^_^

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

  • #2
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    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".

  • #3
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    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();

  • #4
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    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".


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •