I have the following html code in bootstrap:
<div class="panel panel-default text-center">
<div class="panel-heading">
<h3>Team Meta Data</h3>
</div><!--panel heading end-->
<hr>
<form class="form-horizontal" id="team-meta-form">
<input type="hidden" id="option" name="option" value="12">
<input type="hidden" id="tab-type" name="tab-type" value="team">
<div class="form-group">
<label for="team-meta-page-title" class="col-sm-3 control-label">Meta Page Title:</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="team-meta-page-title" name="meta-page-title">
</div>
<span class="col-xs-3">(Enter Page Title)</span>
</div>
<div class="form-group">
<label for="team-meta-page-description" class="col-sm-3 control-label">Meta Page Description:</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="team-meta-page-description" name="meta-page-description">
</div>
<span class="col-xs-3"> (Enter Meta Page Description)</span>
</div>
<div class="form-group">
<label for="team-meta-keywords" class="col-sm-3 control-label">Meta Keywords:</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="team-meta-keywords" name="meta-keywords">
</div>
<span class="col-xs-3">(Enter Meta Keywords)</span>
</div>
</form>
<div class="panel-footer">
<button class="btn btn-lg" id="team-meta-submit" class="add_meta_submit">Save Changes</button>
<br><div id="teammetamsg" name="teammetamsg"></div>
</div><!--panel footer end-->
</div><!--panel end-->
The button has the class "add_meta_submit". There are about 6 similar bootstrap panes all inside one main div. Each pane also has its own form. I created a super simple click handler as follows.
$('.add_meta_submit').click(function(){
alert("click worked");
});
This is totally not working. If I access the click event by id like this:
$("#meta-submit").click(function(){
it works every time. The class event I cannot get to work. I have 6 forms with very similar data and I would like to simply capture all the forms and send them to the same backend function. Basically I want to start the function from the class click then based on the id of the element click serialize the form and send it to the backend.