0
JavaScript变量我有这样的代码:编辑HTML使用jQuery
var a = '<span class="select-me">hohoho</span><input type="text" class="alias" />';
$(a).filter('input.alias').val('my new alias');
console.log(a);
我能做到这一点使用jQuery filter
方法?
上午期望的console.log(一),
<span class="select-me">hohoho</span><input type="text" class="alias" value="my new alias" />
当然可以,但你需要关闭的类型引号=“文本” – Anton
你为什么不自己尝试一下? :)) – moonwave99
不确定你的查询究竟是什么,仍然通过这个[http://jsperf.com/jquery-selector-data-attr-vs-class/12]。希望它有助于弄清楚事情。 – Learner