I have HTML structure something like this
<div id="DeltaPlaceHolderLeftNavBar">
   <div>
   <div>
      <ul>
         <li><a href="link1.php"><span class="someclass">LINK1</span></a>
            <ul>
               <li><a href="link1a.php"><span class="someclass">LINK1A</span></a></li>
            </ul>
         </li>
         <li><a href="link2.php"><span class="someclass">LINK2</span></a></li>
      </ul>
   </div>
   </div>
</div>
I want to change the HREF of those LI which contain a child UL. As you can see above LINK1 contain UL inside it, but LINK2 doesn't, so for that I wrote the following jquery code but it is not working.
$('#DeltaPlaceHolderLeftNavBar div>div>ul>li>a').click(function()
{
   if($(this).closest("li").children("ul").length > 0)
   {
      //the code comes inside this condition but following line doesn't work
      $(this).closest("li").children("ul").attr("href","#");
   }
});
EDIT
Added "href" tags in code
EDIT Made a mistake in HTML as I forgot one div which I have added now.
 
    