我有以下代码,我需要访问此处的输入文本字段 ID,其类名为“company”。
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#overview" >Overview</a></li>
<li class=""><a href="#addManagerTag" class="addManager" >Managers</a></li>
</ul>
</div>
<div class="tab-pane" id="addManagerTag">
<div class="container">
<!-- Main component for a primary marketing message or call to action -->
<form class="form-horizontal" method="post" action="manager.php">
<fieldset>
<!-- Form Name -->
<br />
<!-- Text input-->
<div class="form-group">
<label class="col-lg-2 control-label" for="man_name">Company Name</label>
<div class="col-lg-10">
<input type="text" class="company" id="{COM_ID}" placeholder="" value="here" readonly>
</div>
</div>
</fieldset>
</form>
</div>
<!-- /container -->
</div>
//i am using following Jquery function
$('.addManager').on( 'click', function( event ) {
// how can i access the input text field ID here.
}
如有任何帮助,我们将不胜感激。 谢谢
最佳答案
试试这个:
$('.addManager').on( 'click', function( event ) {
alert($("input.company").attr("id"));
});
fiddle :http://jsfiddle.net/JhZkj/
关于javascript - 访问内部 DIV id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24684532/