Example of JQuery Querying

I was trying to tap into Telerik Markup using JQuery, and I had an epiphany why what I was trying to do wasn't working.  What I was trying to do was target a DIV element, and I did this:

$(control.get_element()).children("DIV > DIV.message").html("New update");

What I was expecting was to update the DIV with the message.  However, the children method returns the reference to the parent DIV, which happens to have a child with a class name of message.  Switching this to:

$(control.get_element()).children("DIV").children("DIV.message").html("New Update");

Fixed the issue.  In actuality, what I did was because there was only one message, by supplying a unique ID, I could do:

$("#myuniqueid").html("New Update");

And circumvented this whole mess!

Published Tuesday, April 07, 2009 8:28 PM by bmains
Filed under: ,

Comments

No Comments