简体   繁体   English

获取动态值以输入类型“文本”

[英]Get dynamic value to input type“text”

I am trying to customize TurnJS with some special effects. 我正在尝试使用一些特殊效果自定义TurnJS I need to show current page number while flip each page into a <input type="text" id="pageNumber" value=""> field. 我需要在将每个页面翻转到<input type="text" id="pageNumber" value="">字段时显示当前页码。

The value should get with this function (added alert for test) : 该值应通过此函数获得(已添加测试警报)

$("#flipbook").bind("turned", function(event, page, view) {
  alert("Page: "+$("#flipbook").turn("view")[0] +$("#flipbook").turn("view")[1] );
});

How can I get this value to the <input> field? 我如何才能将此值添加到<input>字段?

Can I use this: Get the value in an input text box ? 我可以使用此方法: 在输入文本框中获取值吗?

You can use the jQuery .val() method to fill the input-tag. 您可以使用jQuery .val()方法填充输入标签。

$("#flipbook").bind("turned", function(event, page, view) {
  $('#pageNumber').val(page);
});

See jQuery .val() 参见jQuery .val()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM