用jQuery将一个.html中的两个div组合在一起

时间:2015-10-02 11:19:37

标签: javascript jquery html

我有一个包含内容的div

Sub CreatePivot()
' Creates a PivotTable report from the table on Sheet1
' by using the PivotTableWizard method with the PivotFields
' method to specify the fields in the PivotTable.
Dim objTable As PivotTable, objField As PivotField

' Select the sheet and first cell of the table that contains the data.
ActiveWorkbook.Sheets("DATA").Select
Range("A1").Select

' Create the PivotTable object based on the Employee data on PIVOT with the name 'PivotTableName'.
Set objTable = ActiveWorkbook.Sheets("DATA").PivotTableWizard(TableDestination:="PIVOT!R1C1", TableName:="PivotTableName")

'Remove grand totals
With Sheets("PIVOT").PivotTables("PivotTableName")
    .ColumnGrand = False
    .RowGrand = False
End With

' Specify row and column fields.
Set objField = objTable.PivotFields("CCY")
objField.Orientation = xlRowField

Set objField = objTable.PivotFields("ACC")
objField.Orientation = xlRowField

Set objField = objTable.PivotFields("VD")
objField.Orientation = xlColumnField

' Specify a data field with its summary
' function and format.
Set objField = objTable.PivotFields("AMOUNT")
objField.Orientation = xlDataField
objField.Function = xlSum
objField.NumberFormat = "#,##0"

End Sub

这一点填补了第三个

<div class="takemyvalue">Blah</div>

如何加入另一个div的值以进入filldiv:

$('.filldiv').val(  $('.takemyvalue').html());

因此输出将是&#39; Blah Boo&#39;

1 个答案:

答案 0 :(得分:5)

您可以使用jquery .text()或。html()获取每个public class MyScreen extends MainScreen { public MyScreen() { super(NO_HORIZONTAL_SCROLL); VerticalFieldManager manager = new VerticalFieldManager(USE_ALL_WIDTH | NO_VERTICAL_SCROLL | NO_HORIZONTAL_SCROLL); manager.setBackground(BackgroundFactory.createBitmapBackground(null)); // Your bitmap here instead of null add(manager); ButtonField button = new ButtonField("Button", FIELD_HCENTER); manager.add(button); } } 的文本并将它们合并到新div(使用类div)中:

&#13;
&#13;
.filldiv
&#13;
$('.filldiv').text($('.takemyvalue').text() + $('.takemyvalue2').text());
&#13;
&#13;
&#13;

  

.val()方法主要用于获取表单元素的值   例如input,select和textarea。在选择元素的情况下,它   没有选择选项时返回null,并且包含一个数组   当至少有一个时,每个选定选项的值都是   可以选择更多,因为存在multiple属性。

同样如评论中所述,您可以使用.append()来保留<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="takemyvalue">Blah</div> <div class="takemyvalue2">Boo</div> <div class="filldiv"></div>内容:

&#13;
&#13;
.filldiv
&#13;
$('.filldiv').append($('.takemyvalue').text() + $('.takemyvalue2').text());
&#13;
&#13;
&#13;