javascript - InnerHTML + find() not working -
i've been searching , trying different codes, don't came solution.
this script i'm trying create this:
when user clicks inside div class="box". program save in variable content of box.
var boxcontent = $(this).parents('.box')[0].innerhtml;
so, value of variable boxcontent (acording html output be) returns hole div user clicked:
<div class="box"> <div class="url_id"> <span>http://test.com</span> <span id="id">3232434</span> </div> <div class="info"> <a href="#"></a> </div> <div class="secondlink"> <a href="#"></a> </div> </div> now i'd take div process later , append in table. tried use find(), doesn't work...
var url = boxcontent.find('.boxsongurl'); what can do?? in advance.
your statement:
so, value of variable boxcontent (acording html output be) returns hole div user clicked:
is not true. innerhtml returns string of markup html inside element. use jquery's .find() method, have select jquery object:
var url = $(this).parents('.box').find('.boxsongurl');
Comments
Post a Comment