javascript - Jquery Div Changes Not Affected With in the Script -


i have div multiple dropdowns. dropdowns doesn't have id. working other logic remove , add dropdowns within div. if remove dropdown means changes doesn't affect in same script.

$(document).ready(function () { $(function () {     alert($('#show_lable_categories').find('select').length)); // return 5    //now remove dropdowns    $('#show_value_categories').find("select").slice(2).remove();    alert($('#show_lable_categories').find('select').length)); //always return 5 //i need 3 instead of 5 in script  }); }); 

 $('#show_value_categories').find("select").slice(2).remove(); 

i think issue might made typo on element selecting, changes $('#show_value_categories') $('#show_lable_categories').

also tip, want have variable such as:

var dropdown = $('#show_value_categories') 

to avoid bugs such these not have find same element twice.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -