小编Tom*_*ine的帖子

jQuery height()在可见div上返回0 - 为什么?

我有一个容器(thetext1),设置高度为360px."thetext1"包含两个div--一个在左边,一个向右浮动 - 两个内容都是通过ajax调用传递的.

有时候这些div中的一个或另一个中的内容超过360px,因此我想相应地增加text1的高度.

我的测试代码

newhgt = $('#thetext1').find('div.rhs').css("background", "pink").height();
Run Code Online (Sandbox Code Playgroud)

返回0 - (我的选择器是正确的,因为目标div是完全粉红色的!).

为什么是这样?我知道 - 从本网站以前帖子的答案 - 解决方案是添加溢出:隐藏thetext1,但我想理解为什么我试图获得rhs和lhs div的高度失败.

css jquery

40
推荐指数
3
解决办法
4万
查看次数

将 *ngFor 与 ng-container 和 *ngIf 一起使用

我的表单的一个部分包含一组 n 个单选按钮(我们将在这里设置 n=3),它们在模板中显示为:

<input type="radio" name="variety" value="11" (click)="update($event)">SomeNameX
<input type="radio" name="variety" value="23" (click)="update($event)">SomeNameY
<input type="radio" name="variety" value="36" (click)="update($event)">SomeNameZ
Run Code Online (Sandbox Code Playgroud)

在选择适当的SOMENAME时,我要在单选按钮下方提出其中一个:

<div *ngIf="selected===11">Last updated: Sept 1</div>
<div *ngIf="selected===23">Last updated: Oct 3</div>
<div *ngIf="selected===36">Last updated: Nov 4</div> 
Run Code Online (Sandbox Code Playgroud)

其中每个 SomeName 的日期和值是从数据库返回的。我正在使用以下代码来完成这项工作:

<ng-container *ngFor="let item of items;">
   <div *ngIf="selected==={{item.id}}">
   Last updated:  {{item.dte}}
   </div>
</ng-container>
Run Code Online (Sandbox Code Playgroud)

这是因为这{{item.id}}件作品而失败- 我如何将正确的值/ID 注入该位置?

angular

7
推荐指数
1
解决办法
1万
查看次数

Is there an efficient way of adding user_id using updateOrCreate?

I'm trying to add/update responses from a multi-field form using updateOrCreate.

I'm avoiding having to write out the second argument in full for each field in the form by using $request->all. However, this approach so far is precluding me from adding the value for user_id that is needed for the record to be complete. That value (`$userId') is obtained in the controller as shown:

  $userId = Auth::user()->id;

  $cropid = $request->id;
  Crop::updateOrCreate(['id'=>$cropid],$request->all());  
Run Code Online (Sandbox Code Playgroud)

Is there a way of retaining the $request->all …

laravel

0
推荐指数
1
解决办法
33
查看次数

标签 统计

angular ×1

css ×1

jquery ×1

laravel ×1