1

I have this code:

$doc.find('#g').on('click', function(e) { 
   $target = $doc.find('#g form');
   $target.toggle();
   $doc.find('#g input[type="text"]').focus();
});   

I want it to stop triggering on children so this works:

$doc.find('#g form').on('click', function(e){
    e.stopPropagation();
});

So using #g form works, but selectors like #g * or #g>* or .children() do not work, why?

The html structure is like this:

<div id="g" title="look up">
<i class="fa fa-search-plus"></i>
<i class="fa fa-search-minus" style="display: none"></i>
    <div></div>
    <form><div>
            <input>
            <input>
            <input>
            <input>
          </div>
    <input><input><input></form>
</div>
untore
  • 603
  • 8
  • 16
  • What is wildcard? what you trying to do? – freethinker Apr 28 '15 at 18:27
  • 2
    need to see html structure. We don't know what `children` there are for example and `#g *` is very different than `#g>*`. Really need to improve question with more code and expectations of what you want the code to do or what it isn't doing properly – charlietfl Apr 28 '15 at 18:28
  • 1
    http://stackoverflow.com/questions/5376431/wildcards-in-jquery-selectors – makeitmorehuman Apr 28 '15 at 18:28
  • 1
    @XGreen link is not a duplicate. This question is asking about a css selector ([universal](https://developer.mozilla.org/en-US/docs/Web/CSS/Universal_selectors) or child), the other is asking about a wildcard that jQuery will parse and match regex like. There may be a way to use such jQuery wildcard to find all children of the `#g` element, but that would be a worthy answer to this question. – Patrick M Apr 28 '15 at 22:02
  • 1
    I can't see where I have suggested it was a duplicate. I found a useful link and thought provide as comment and perhaps would be useful. – makeitmorehuman Apr 28 '15 at 22:06
  • seems to work for me, what is doc referencing? maybe the behavior is not working, try just running the selector. – David Nguyen May 04 '15 at 15:11
  • there isn't one html is pretty much that just another div then body tag – untore May 04 '15 at 15:23

0 Answers0