我想用jQuery选择一个textarea
元素,其类名为sendMessage
:
<script>tinymce.init({ selector:'textarea' });</script>
那么如何将这个特定元素的classname
添加到这行代码中呢?
答案 0 :(得分:2)
类选择器由点(。)表示,如下所示
debian:~/user$ curl -Ss -H "Authorization: Bearer atkn" https://api.spotify.com/v1/users/bugenwilla/playlists|jq -r '.items[]|select(.name=="myplaylist")|[.tracks.total, .id]'
[
1543,
"playlistid"
]
debian:~/user$ curl -Ss -H "Authorization: Bearer atkn" https://api.spotify.com/v1/users/username/playlists/playlistid/tracks | jq -r '.items[] | .track.album.artists[].name' | wc -l
108
debian:~/user$ curl -Ss -H "Authorization: Bearer atkn" https://api.spotify.com/v1/users/username/playlists/playlistid/tracks | jq -r '.limit, .total'
100
1543
答案 1 :(得分:0)
<强> Working fiddle 强>
你可以简单地使用类符号(点).
,它看起来像:
tinymce.init({ selector:'.sendMessage ' });
//or
tinymce.init({ selector:'textarea.sendMessage ' });
段:
tinymce.init({
selector: "textarea.sendMessage"
});
&#13;
<script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<textarea class="sendMessage">Congratulations!</textarea>
&#13;