which <div /> currently has class="toggle", add id="PvsK"

then you can call document.getElementById("PvsK").getAttribute
("toggled")

HTH,
/dave

On Jan 18, 8:57 pm, anmldr <[email protected]> wrote:
> I am using the toggle button from iUI. I need to add to a way to find
> out if the value is "Yes" vs "No" or "True" vs "False".  In my case, I
> am using "Pounds" vs "Kilograms" (or lbs vs kgs) before I perform a
> calculation. I do NOT know js and so would appreciate some help. What
> would I add in the HTML and/or js to be able to see which is selected?
>
> The js for this is:
>
> (function() {
> addEventListener("click", function(event)
> {
>     var div = findParent(event.target, "div");
>     if (div && hasClass(div, "toggle"))
>     {
>         div.setAttribute("toggled", div.getAttribute("toggled") !=
> "true");
>         event.preventDefault();
>     }
>
> }, true);
>
> function findParent(node, localName)
> {
>     while (node && (node.nodeType != 1 || node.localName.toLowerCase
> () != localName))
>         node = node.parentNode;
>     return node;
>
> }
>
> function hasClass(self, name)
> {
>     var re = new RegExp("(^|\\s)"+name+"($|\\s)");
>     return re.exec(self.getAttribute("class")) != null;
>
> }
> })();
>
> Linda
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to