Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's very hard to figure out what you're asking. It <em>sounds</em> as though you're asking how to respond to clicks on different "properties" links with different classes by opening different dialog boxes. That would be trivial: Just hook the click event on the relevant "properties" links using <a href="http://api.jquery.com/bind/" rel="nofollow"><code>bind</code></a> (<a href="http://api.jquery.com/click/" rel="nofollow"><code>click</code></a>), <a href="http://api.jquery.com/delegate/" rel="nofollow"><code>delegate</code></a>, or <a href="http://api.jquery.com/live/" rel="nofollow"><code>live</code></a>:</p> <pre><code>$("a.type1").click(function() { // Open the dialog for type1 // ... // Prevent the default action of the link return false; }); $("a.type2").click(function() { // Open the dialog for type2 // ... // Prevent the default action of the link }); </code></pre> <p>(And again, you might use <a href="http://api.jquery.com/delegate/" rel="nofollow"><code>delegate</code></a> or <a href="http://api.jquery.com/live/" rel="nofollow"><code>live</code></a> rather than binding the event on the elements themselves, if this is dynamic at all.)</p> <p>Or if you want to use a common handler for all the types and branch within the handler, you could do that:</p> <pre><code>$("a.type1, a.type2, a.type3").click(function() { // ...code all of them have in common... // ... // Branch on what class(es) the link has and open the relevant dialog // ... // ...more code all of them have in common... // ... // Prevent the default action of the link return false; }); </code></pre> <p>You can use multiple classes (so each link has both "props" and "type1" or "type2", etc.)</p> <p>If you mean that the links <em>won't</em> actually have different types, but you want to branch on what's in the same container they are or something, you can use <code>closest</code> to go up to the container you want, then <code>find</code> and/or <code>children</code> to find out what's in the container:</p> <pre><code>$("a.props").click(function() { var container = $(this).closest('div'); // If the container is a div if (container.find("textarea")[0]) { // It has at least one text area, show dialog... } else if (container.find("input[type=text]")[0]) { // It has at least one text input, show dialog... } else if (container.find("input[type=button]")[0]) { // It has at least one `input`-style button, show dialog... } // else etc. // Prevent the default action of the link return false; }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload