troubleshooting Question

ajax; dropdown menu - not using jquery or mvc

Avatar of goodk
goodkFlag for United States of America asked on
JavaScriptAJAX
8 Comments1 Solution402 ViewsLast Modified:

initially displayed:

<ul id="DevMenu">
        <li id="cli">
            <input type='button' id='Button1' value='asdf' onclick="showhide(this.value)" />
        </li>
 </ul>

then I want to replace cli by input text,


function showhide(str) {
            //  alert(str);
            document.getElementById("cli").innerHTML = "<input type='text' id='Text1' onkeyup='showHint(this.value)' />";

        }

so the above works correctly and I see the text input displayed, now I want to display selected ul, and I do the following

document.getElementById("cli").innerHTML = "<input type='text' id='Text1' onkeyup='showHint(this.value)' />"
 + " <ul class='DevMenu first'> <li><a href='e' title='tr'>16 Mach</a></li> <li><a href='x' title='t2'>2 Lots </a></li> </ul>  "

but the above part does not work,

basically I expected to see a dropdown,  by the way if do the above in one string it works, so my string is correct.  What I am asking is how do we dynamically manupulate innerstring using the Ajax.  Behind the scene I am using ajax to replace the string.

please help how do we do three levels of string manupulations, 1- button, 2- text, 3- a dropdown.

Please do not refer me to an example, just guide me how to replace innerhtml???? thanks a lot.

I am basically trying to expand the following, example to a dropdown.
http://www.w3schools.com/ajax/ajax_aspphp.asp




ASKER CERTIFIED SOLUTION
goodk

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros