2008年
4月 24
jQuery で属性値を変更する方法を Google で検索すると
$('#hoge').set('href', 'http://www.syuhari.jp/');
というやり方が結構ヒットするのですが、jQuery1.2.x では
$('#hoge').attr('href', 'http://www.syuhari.jp/');
のように attr メソッドを使用します。
参考:Attributes/attr – jQuery JavaScript Library
関連する投稿
Leave a Reply
Additional comments powered by BackType
Recent Comments