i have placed a text box with onclick and onblur event. onclick shows contents(links) of a div tag below it and onblur hides the div
basically it was a jquery based drop down menu but due to some problem I need to avoid jquery. Now the problem happens when a link of div tag is clicked. The link does not work due to onblur event on the textbox. Any suggestion?

<input type="text" style="text-transform: capitalize;" value="" class="abd_txtfld" name="loc" id="loc" onclick="gettabcontentSearch('','')" onblur="hide()"/>
<div id="cityddsearch" class="select_citydd" style="position: absolute; margin-top: 2px; left: 5px; display: none;">
<ul>
<li><a href='../link1.asp'>link1</a></li>
<li><a href='../link2.asp'>link2</a></li>
<li><a href='../link3.asp'>link3</a></li>
</ul>
</div> 

I need the javascript source code to see if the functions "gettabcontentSearch" & "hide" dont contain errors. I'm assuming they don't, then try the below code. Replace what you have got up there with that. And tell us if it works, OK?

onclick="gettabcontentSearch('','');" onblur="hide();"

Another thing to note is that does the the function gettabcontentSearch take arguments? if not, then take out the args and try it. they might be causing the errors.

I noticed something in your HTML code. The HREF's have asp files in them? Do they exist in the same folder?

The functions are as follows

function gettabcontentSearch(cityname,citycode)
{
cityobj = document.getElementById("cityddsearch");
cityobj.style.display = 'inline'
}

ntentSearch(cityname,citycode)
{
cityobj = document.getElementById("cityddsearch");
cityobj.style.display = 'inline'
}
function hide()
{
cityobj = document.getElementById("cityddsearch");
cityobj.style.display = 'none'
}

I planned to pass the variables for some reason but I can avoid it
Actually when a link from the

function hide()
{
cityobj = document.getElementById("cityddsearch");
cityobj.style.display = 'none'
}

I planned to pass 2 variables for some reason but I can avoid it
Actually when a link from the div tag is clicked, the onblur event gets fired which i believe stops the onclick event of the link

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.