i think that adding html from xml has patchy results.

i tried and it did not work in ie at all well!

i got introduced to a new friend called json.

to make the html active, if i understand you, all you need do is

add click, hover etc to whatever.  if these are already applied to objects then (i have successfully)
used unclick (no unhover its not required) etc to resolve double event calls

(some of my phraseology might be mismatched, not a blackbelt _javascript_er [yet])

hope this helps

On 10/11/06, Scott Sharkey <[EMAIL PROTECTED]> wrote:
Anyone?

-------- Original Message --------
Subject: [jQuery] How to Add HTML to a page, and make it "active"?
Date: Thu, 09 Nov 2006 16:24:54 -0500
From: Scott Sharkey < [EMAIL PROTECTED]>
Reply-To: jQuery Discussion. <discuss@jquery.com>
Organization: Linux Unlimited, LLC
To: discuss@jquery.com

Hi All,

Relatively new to jQuery, and loving it so far.  Hopefully you can help
me with this one...

I have a "quote page", which has "line items" that fetch various pieces
of info (via ajax) from the server as the user starts "drilling down".
There are a variable number of "line items", of 4 different types.  I
have the code to create a new line item of a given type whenever the
user selects that type from a selection box.

Let's say one of the "line items" looks like this:

      Type: <select box: ceramic or metal>
      Material: <filled by ajax, depending on selection above>
      Description: <filled by ajax, depending on material selected>
      Quantity: <standard input field>

I've got the code to insert the HTML necessary for the above working so
far.  Only big problem here was generating a "unique id field" for the
fields, which I did by having a _javascript_ global "item count", which is
incremented every time a new line item is added, and which is appended
to each field ID, ie type_1, material_1, desc_1, qty_1, etc.  When they
create a second line item (of any type) it's fields are appended with
_2, etc.

OK, now I have to "activate" the type_1 field, so that on a change,
it will fire off an ajax request to fetch the desired list of materials
for that "type" and fill in the (currently empty) material <div>.

Is this possible?

I *think* that I can do something like:

    $("#type_1").change(function() {
       var type = $("#type_1").val();
       $.post("/ajax/get_material_list.php", {type:type}, function(xml) {

          ... function body to process the xml results here...
          )};
       )};

except, of course that "#type_1" above needs to be a _javascript_ variable
string, rather than a constant.  Of course, the function body for
fetching the results must also "enable" an ajax call on a change to the
(new) material selection field, to fetch the description.

Am I even close to on the right track, or is there a better way to do
this?  Should I be generating the html on the server, with the
_javascript_, and passing it back, instead of generating the html with
jQuery in the client?  ANY suggestions would be welcomed!

-Scott

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to