如何到达';这';Jquery中.css部分中的元素
我有一些按钮,在我的文档上有一个类名NextButton。文档中可以同时有一个或多个nextbutton。但它们的宽度不同,如下所示如何到达';这';Jquery中.css部分中的元素,jquery,css,Jquery,Css,我有一些按钮,在我的文档上有一个类名NextButton。文档中可以同时有一个或多个nextbutton。但它们的宽度不同,如下所示 <input type="button" class="NextButton grid3" value="Continue" /> <input type="button" class="NextButton grid14" value="TestTest TestTest" /> 提前感谢, 现场示例 $('input[type=bu
<input type="button" class="NextButton grid3" value="Continue" />
<input type="button" class="NextButton grid14" value="TestTest TestTest" />
提前感谢,
现场示例
$('input[type=button].NextButton')
.wrap(“”)
.parent()
.css('width',function(){
返回$(this).outerWidth()+'px';
}).附加(
$('', {
“类”:“图标”
})。单击(函数(){
警报(“点击”);
})
);
.尝试使用
$(slector).each(function(i,e){
$(e).dostuff() <-- here is the current element and this will aplly to each element
$(e).css('width'); <-- will return the width of the current elem
});
$(slector)。每个(函数(i,e){
$(e).dostuff()
.css('width',$('input[type=button].NextButton').outerWidth() + 'px')
$('input[type=button].NextButton')
.wrap('<div class="NextButton" />')
.parent()
.css('width', function() {
return $(this).outerWidth() + 'px';
}).append(
$('<div/>', {
'class': 'Icon'
}).click(function() {
alert('clicked');
})
);
$(slector).each(function(i,e){
$(e).dostuff() <-- here is the current element and this will aplly to each element
$(e).css('width'); <-- will return the width of the current elem
});