【发布时间】:2016-01-11 07:11:01
【问题描述】:
我正在使用owl carousel jQuery 图像滑块,我想从当前滑块中获取文本框值。我添加了单击事件以从当前滑块获取文本框值,但不知道如何从中读取。
知道怎么做吗?
这是我的 JSFiddle:http://jsfiddle.net/8bJUc/575/
HTML:
<div id="dino-example" class="dino-carousel">
<div class="item">
<img src="http://johntomsett.files.wordpress.com/2014/03/14525_1_v12_tp.jpg" alt="dinosaur1"></img>
<input type="text" class="inv" value="1">
</div>
<div class="item">
<img src="http://images.clipartpanda.com/t-rex-dinosaur-clip-art-T-Rex-Dinosaur_1.png" alt="dinosaur2"></img>
<input type="text" class="inv" value="2">
</div>
<div class="item">
<img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQbuwkU3kDpr4rByYQ3ydbTPv6zP1L0yhrKB00fa5YhkY0i9WKFWA" alt="dinosaur3"></img>
<input type="text" class="inv" value="3">
</div>
<div class="item">
<img src="http://content.animalnewyork.com/wp-content/uploads/new-dinosaur-nasutoceratops.jpg" alt="dinosaur4"></img>
<input type="text" class="inv" value="4">
</div>
</div>
<div>
<a href="#" class="get">Get value from textbox</a>
</div>
jQuery:
$(document).ready(function() {
$("#dino-example").owlCarousel({
items: 5,
singleItem: true
});
});
$(document.body).on('click', '.get' ,function(){
alert('hey');
});
【问题讨论】:
标签: javascript jquery html slider owl-carousel