首页 > zeptojs如何获取和修改<button>Test</button>中的Test文本

zeptojs如何获取和修改<button>Test</button>中的Test文本

zeptojs如何获取和修改<button>Test</button>中的Test文本

<button name="ModBtn" id="ModBtn" value="">Test</button>

请问各位大大,如何用zeptojs的语法获取以上button的文本“Test”,同时如何修改
通过$("#ModBtn").val()、$("#ModBtn").text()、$("#ModBtn").html()都得不到

参考看了jquery,能用选择器”:button“来操作,但是如何对指定ID的button进行操作?

谢谢大大们


试过了,jquery是支持rebiekong大大的用法的,但是zeptojs不支持这类选择器

百度搜索看到了同在Segmentfault.com的这篇文章:https://.com/a/1190000000645094
话说Segmentfault真的做的不错,刚发的这篇帖子,百度已经收录了,应该还是Segmentfault做的SEO好,当然百度爬虫也够厉害的

zeptojs.com官网也看到了这个说明

jQuery CSS extensions are not supported. However, the optional
"selector" module provides limited support for a few of the most used
pseudo-selectors, and can be dropped in for compatibility with
existing code or plugins.

Zepto will only set the $ global to itself if it is not yet defined.
This allows you to use Zepto with legacy code that uses, for example,
Prototype.js. Just load Prototype first, and Zepto will not touch
Prototype's $ function. Zepto will always set the Zepto global to
itself.

那么如何用纯javascript实现<button>的选择和操作呢???
谢谢大大了


没有什么区别的啊,参考CSS选择器的语法$("#ModBtn:button")先console一下看能不能抓到


用原生就可以了吧。。。innerHTML

【热门文章】
【热门文章】