Find items with Jquery

0

Good afternoon masters

I've been trying to get to an item with jquery but I do not give maybe they can help me

with many boxes with the same attributes and I want to get from #desde_aqui to #quiero llegar aquí

<div class="card negociaciones" style="border:0">
<div class="card-body" style="padding:0">
    <div class="row">
        <div class="col-10">
            <img class="rounded-circle" src="" width="36" height="36"alt="">
            <span><strong>'.$cacadevaca2.' :</strong> </span>

        </div>
        <div class="col-2 d-flex justify-content-end botones">
            <i class="fas fa-reply ml-2" id="desde_aqui" data-comment="50" style="color:#ffc107; cursor:pointer" title="Responder"></i>
        </div>
        <div class="col-12 mb-2">
            <p>contenido</p>
        </div>
        <div  class="col-12 respuestas ">
            <div class="form-group d-none quiero_llegar_aqui">
                <input type="text" class="form-control" id="text" rows="1" placeholder="Escribe tu comentario">
            </div>
        </div>
    </div>
</div>

this is jquery of the button

    $(document).on('click', '#desde_aqui', function(event) {
      alert('message?: DOMString')
})

and toggle class d-none the .card are generated with php and jquery

but I do not know how to get out and go

    
asked by daniel 15.07.2018 в 03:13
source

2 answers

1

I join the comment that the question is not well understood, but I leave you an example code that may guide you in what you need.

<div class="card negociaciones" style="border:0">
<div class="card-body" style="padding:0">
    <div class="row">
        <div class="col-10">
            <img class="rounded-circle" src="" width="36" height="36" alt="">
            <span>
                <strong>'.$cacadevaca2.' :</strong>
            </span>

        </div>
        <div class="col-2 d-flex justify-content-end botones">
            <i class="fas fa-reply ml-2" id="desde_aqui" data-comment="50" style="color:#ffc107; cursor:pointer" title="Responder">aqui</i>
        </div>
        <div class="col-12 mb-2">
            <p>contenido</p>
        </div>
        <div class="col-12 respuestas ">
            <div class="form-group d-none quiero_llegar_aqui">
                <input type="text" class="form-control" id="text" rows="1" placeholder="Escribe tu comentario">
            </div>
        </div>
    </div>
</div>


<script>
    $(document).on('click', '#desde_aqui', function (event) {
        var title = $('#desde_aqui').attr("title");
        $('.quiero_llegar_aqui').append(title);
    })
</script>
    
answered by 15.07.2018 в 04:10
0

Hello, although you already commented the answer above I give you another if you need to find an item with jquery you can use the .find () function of jquery.

simple example:

$( "li.item-ii" ).find( "li" ).css( "background-color", "red" );
<ul class="level-1">
  <li class="item-i">I</li>
  <li class="item-ii">II
    <ul class="level-2">
      <li class="item-a">A</li>
      <li class="item-b">B
        <ul class="level-3">
          <li class="item-1">1</li>
          <li class="item-2">2</li>
          <li class="item-3">3</li>
        </ul>
      </li>
      <li class="item-c">C</li>
    </ul>
  </li>
  <li class="item-iii">III</li>
</ul>

If you need to look for it by attributo?

you can do it in the following way:

$( "input[value='Hot Fuzz']" ).next().text( "Hot Fuzz" );

likewise if you want to search for it by class the element you can look for it like this:

$( ".myClass" ).css( "border", "3px solid red" );

If you want more information on how to search / select an element, look at this resource in English:

using jquery by find a element

Here is a simple example with which you can base yourself:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
  
</head>
<body>
  
  
<ul class="level-1">
  <li class="item-i">I</li>
  <li class="item-ii">II
    <ul class="level-2">
      <li class="item-a">A</li>
      <li class="item-b">B
        <ul class="level-3">
          <li class="item-1">1</li>
          <li class="item-2">2</li>
          <li class="item-3">3</li>
        </ul>
      </li>
      <li class="item-c">C</li>
    </ul>
  </li>
  <li class="item-iii">III</li>
</ul>

  

<script>

 $( "li.item-ii" ).find( "li" ).css( "background-color", "red" );

</script>


</body>
</html>

and if you are interested in doing it from JS look at this function: find / get an item with JS

    
answered by 15.07.2018 в 05:19