jquery - each on a class inside a parent class -


html:

<div class="busket ">                          <button id="buybtn" class="btn btn-success" href="#ordermodal" data-toggle="modal" name="id" data-id=",1,2" data-quantity=",1,1"><span class="icon16  icomoon-icon-checkmark-2"></span>buy</button>                <div class="form-row row-fluid" id="addeditem1"><div class="cpan12"><div class="span4"> <span class="ui-spinner ui-widget ui-widget-content ui-corner-all"><input class="spinner1 ui-spinner-input" id="addedq1" value="1" min="1" name="value" aria-valuemin="1" aria-valuenow="1" autocomplete="off" role="spinbutton"><a class="ui-spinner-button ui-spinner-up ui-corner-tr ui-button ui-widget ui-state-default ui-button-text-only" tabindex="-1" role="button" aria-disabled="false"><span class="ui-button-text"><span class="ui-icon ui-icon-triangle-1-n">▲</span></span></a><a class="ui-spinner-button ui-spinner-down ui-corner-br ui-button ui-widget ui-state-default ui-button-text-only" tabindex="-1" role="button" aria-disabled="false"><span class="ui-button-text"><span class="ui-icon ui-icon-triangle-1-s">▼</span></span></a></span></div></div><div class="span6"><img class="addedimg" src="/amrajegeachi18/productimages/small/1.png"></div><div class="span2"><span class="icon12 remove-item icomoon-icon-cancel" id="1"></span></div></div><div class="form-row row-fluid" id="addeditem2"><div class="cpan12"><div class="span4"> <span class="ui-spinner ui-widget ui-widget-content ui-corner-all"><input class="spinner1 ui-spinner-input" id="addedq2" value="1" min="1" name="value" aria-valuemin="1" aria-valuenow="1" autocomplete="off" role="spinbutton"><a class="ui-spinner-button ui-spinner-up ui-corner-tr ui-button ui-widget ui-state-default ui-button-text-only" tabindex="-1" role="button" aria-disabled="false"><span class="ui-button-text"><span class="ui-icon ui-icon-triangle-1-n">▲</span></span></a><a class="ui-spinner-button ui-spinner-down ui-corner-br ui-button ui-widget ui-state-default ui-button-text-only" tabindex="-1" role="button" aria-disabled="false"><span class="ui-button-text"><span class="ui-icon ui-icon-triangle-1-s">▼</span></span></a></span></div></div><div class="span6"><img class="addedimg" src="/amrajegeachi18/productimages/small/2.png"></div><div class="span2"><span class="icon12 remove-item icomoon-icon-cancel" id="2"></span></div></div></div> 

jquery:

  $('.busket>.spinner1').each(function(){           // var id = $(this).attr('id');            alert('it works');         }); 

there lot of .spinner1 class want each event on spinner1 class inside busket1 class. above jquery code not works. can't re write own code fix issue. idea?

you need this.

$(function() {     $('.busket').find('.spinner1').each(function() {       alert('it works');     }); }); 

this way, find elements class spinner1 inside busket


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -