search

Home  >  Q&A  >  body text

thinkphp3.2.3+jquery hidden problems

Traversed out

< /p>

Then I wanted to use jquery to hide all the traversed things.
I used this jquery code

< /p>

I don’t know why only one is hidden? Aren't all traversed items hidden?

某草草某草草2851 days ago522

reply all(3)I'll reply

  • 習慣沉默

    習慣沉默2017-05-16 13:12:09

    According to the specification, the id is unique in a page. If you generate multiple elements with the same ID in the page, this itself violates the specification. jQuery's id selector instinctively thinks that there can only be one element, so the situation in the problem description occurs!
    Please set the class attribute. Elements that need to have the same performance use the same class name, and then operate the class name to control multiple elements at the same time.
    HTML
    <td class='num'></td><td class='num'></td>

    Javascript
    $('.num').hide();

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-16 13:12:09

    $('[id="num1"]').hide()

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 13:12:09

    Correct solution on the second floor. id is unique. Just change it to class selector

    reply
    0
  • Cancelreply