Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery replacing attr
    primarykey
    data
    text
    <p>I have list of divs that are produced dynamically, which basically users clicks on one of the them ex: the div dat has data-square=0-1 and then clicks on the div data-square=0.8, the class attr and data-square values are being send to server and server approves whether they should be replaced or not. for replacing. but first inner div attr should be replaced by the second one thats clicked, and the first one should have a class=empty</p> <p>before being send to server:</p> <pre><code>&lt;div class="column" data-square="0-1"&gt; &lt;div class="GREEN"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="column" data-square="0-5"&gt; &lt;div class="GREEN"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="column" data-square="0-8"&gt; &lt;div class="YELLOW"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>it should be like this once it receives back from server</p> <pre><code> &lt;div class="column" data-square="0-1"&gt; &lt;div class="EMPTY"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="column" data-square="0-5"&gt; &lt;div class="GREEN"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="column" data-square="0-8"&gt; &lt;div class="GREEN"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>but when i receive from the server, it deletes all the class titled GREEN, it should replace the class titled GREEN which the user clicked the fist time.</p> <p>i can replace and make the first div to empty without sending it to server, but when it comes to , performing the actions upon receiving the entire class gets deleted.</p> <pre><code>$.post("check.php", { from:from,to:to,classFrom:$classFrom,classTo:classTo}, function(data) { $($classFrom).children().removeAttr('class').addClass('EMPTY'); }) </code></pre>
    singulars
    1. This table or related slice is empty.
    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