I am currently figuring out how to use my .each() function with a $(document).ready and a click event. Here's what I have so far:
$(document).ready(function(){
$(".help-inline").each(function() {
$(this).css('display', 'none');
});
});
When working within a form using nested_form, I can clone a field by clicking '.example_button' and would like the newly created element in my DOM to also have the display:none rule applied.
I attempted the following code, but it only applies the rule when I click on '.examnple_button':
$(document).on('click', '.example_button', function(){
$(".help-inline").each(function() {
$(this).css('display', 'none');
});
});
How can I ensure that the css rules are applied under both circumstances?
Thank you