小编sil*_*r27的帖子

如何根据我当前所在的页面/路线使用角度ng-hide?

有一个角度应用程序,如果主视图是主页视图,我想隐藏其中一个"包含的视图".

<div id="page" ng-class="{ showNav: $root.showNav }">
    <header id="pageHeader" ng-controller="HeaderCtrl" data-ng-include="'views/includes/header.html'"></header>
    <div id="pageHero" ng-show='$rootScope.fullView' ng-controller="MainsearchCtrl" data-ng-include="'views/mainSearch.html'"></div>
    <div id="pageContent" ng-view=""></div>
</div>
Run Code Online (Sandbox Code Playgroud)

javascript angularjs ng-show ng-hide

18
推荐指数
2
解决办法
4万
查看次数

如何在javascript函数中显示引导模式?

我的页面上有一个按钮,当它被推送时会触发一些javascript函数发生,并且其中一个javascript函数可以打开一个bootstrap模式,但我似乎无法让它工作.这是我的代码......请帮忙.

 //elsewhere on the form is the button that triggers the javascript
  <a href="#" class="btn btn-danger" id="cancelPObtn" data-dismiss="modal">Yes, cancel it</a>

 <!-- CANCEL A PO MODAL -->
 <div class="modal hide fade" id="error-dialog" style="display: none;">
   <div class="modal-header">
        <a class="close" data-dismiss="modal">x</a>
        <h3>Cancel Purchase Order?</h3>
   </div>
   <div class="modal-body">
   </div>
   <div class="modal-footer">
       <a href="#" class="btn btn-danger btn-modal btn-cancel"  data-dismiss="modal">Yes, cancel it</a>
       <a href="#" class="btn" data-dismiss="modal">Nevermind</a>
   </div>
 </div>




      $('.btn-danger').click(function(event) {
          if(some random conditional statement){
             //some stuff happens here
          }
          else{ 
                //Show form validation error modal-- I …
Run Code Online (Sandbox Code Playgroud)

javascript jquery modal-dialog twitter-bootstrap

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

如何使用angular将单元格colspan基于条件值?

基于html页面上的其他值,我需要在表格中的一行来显示更多单元格,然后表格中的其他位置.为了保持对齐正确并且一切都干净,我正在寻找一种使用角度动态设置单元格的colspan的方法.我似乎无法让这个工作.

<input type="checkbox" ng-model="vm.noInventory"/>

<table>  
  <th>
     <td>Product</td>
     <td colspan={{vm.noInventory ? '2' : '1'}}>Inventory<td>
     <td ng-show="vm.noInventory"></td>
  </tr>
  <tr>
     <td>Product B</td>
     <td>55 parts</td>
     <td ng-show="vm.noInventory">Backordered</td>      
  </tr>

</table>
Run Code Online (Sandbox Code Playgroud)

html conditional html-table inline angularjs

7
推荐指数
2
解决办法
6427
查看次数

如果父元素也有鼠标悬停,如何为子元素触发mouseover事件?

我的页面上有一个"帮助"区域,只要用户将鼠标悬停在表格上,就应该更新帮助信息.问题是我在每行1个单元的复选框表内,而当用户将鼠标悬停在该复选框我想要的复选框的鼠标悬停事件覆盖表事件和复选框的帮助来显示.目前表鼠标悬停工作正常,但当鼠标悬停在复选框上时没有任何反应.

<table class="myTable">
   <tr>
      <th>Col1</th>
      <th>Col2</th>
   </tr>
   <tr>
      <td><input class="myCheckbox" type="checkbox" /></td>
      <td>Cell 2</td>
   </tr>
   <tr>
      <td><input class="myCheckbox" type="checkbox" /></td>
      <td>Cell 3</td>
   </tr>
</table>

<div class="myHelpMenu"></div>


$('.myCheckbox').mouseover(function() {
    $('.myHelpMenu').html("this is my checkbox help");
});

$('.myTable').mouseover(function() {
   $('.myHelpMenu').html("this is my tables help");
});
Run Code Online (Sandbox Code Playgroud)

jquery html-table mouseover hover mouseevent

5
推荐指数
1
解决办法
1352
查看次数

Jquery选择最近的复选框收件箱不起作用

我有一个treelist包含多个级别,checkboxes我试图让父母checkbox显示为点击'checked'任何一个孩子checkboxes.由于某些原因,这不起作用,它正在杀了我.

JAVASCRIPT

$(function() {
        $("input.boundChild[type=checkbox]").click(function() {              
            $(this).closest("input.boundParent").prop("checked", "checked");
        });
 });
Run Code Online (Sandbox Code Playgroud)

HTML

<ul>
   <li class="collapsed expanded">
       <input id="0" class="boundParent" type="checkbox" >
        Australia
             <ul style="display: block;">
               <li>
                  <input id="0/" class="boundChild" type="checkbox" checked="">
                  <input type="hidden" value="Intel Australia PTY Ltd.">
               </li>
             </ul>
   </li>
</ul>
Run Code Online (Sandbox Code Playgroud)

checkbox jquery selector closest

4
推荐指数
1
解决办法
3715
查看次数

jquery datepicker range(mindate maxdate)不起作用

我正在尝试为我的表单上的jquery datepicker设置一个范围,但是当我打开表单时,它允许我选择任何日期.

  <input class="span2 datepicker" name="tw#local#changeRequest#DeliveryDate" type="text" id="dp1">


 <!-- jQuery -->
 <script type="text/javascript" src="<#=tw.system.model.findManagedFileByPath('jquery-1.7.2.min.js', TWManagedFile.Types.Web).url;#>"></script>

 <!-- Datepicker Script -->
 <script type="text/javascript" src="<#=tw.system.model.findManagedFileByPath('bootstrap-datepicker_new.js', TWManagedFile.Types.Web).url;#>"></script>

 <script type="text/javascript">
 $(document).ready(function(){

 $( "#datepicker" ).datepicker({ minDate: -20, maxDate: "+1M +10D" });

 });
 </script>
Run Code Online (Sandbox Code Playgroud)

jquery datepicker range mindate maxdate

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

如何找到父母以前的兄弟姐妹

好的我知道这应该很简单.我有一个包含数据定义和数据标签的列表.我在其中一个数据定义中有输入,因此用户可以定义定义.然后我试图获得该定义的标签名称.在jsfiddle中,警报应该提示"cycle_3" http://jsfiddle.net/M6WJp/

<dl>
  <dt> cycle_1:</dt>
  <dd> test </dd>
  <dt> cycle_2: </dt>
  <dd> test </dd>
  <dt> cycle_3: </dt>
  <dd>
     <input class="myTest" value="test" />
  </dd>
</dl>

var myErrors =$('.myTest').prev('dt').text();
alert(myErrors);
Run Code Online (Sandbox Code Playgroud)

jquery traversal

2
推荐指数
1
解决办法
8302
查看次数

如何将函数名称作为参数传递,然后再引用该函数?

我想将函数"testMath"的名称作为字符串传递给名为"runTest"的包装函数作为参数.然后在'runTest'里面我会调用传递的函数.我这样做的原因是因为我们有一组通用数据,无论测试如何都会填充到变量中,然后根据用户想要测试的内容调用特定的测试.我试图使用javascript/jquery来做到这一点.实际上,该功能要复杂得多,包括一些ajax调用,但这种情况突出了基本的挑战.

//This is the wrapper that will trigger all the tests to be ran
function performMytests(){
     runTest("testMath");    //This is the area that I'm not sure is possible
     runTest("someOtherTestFunction");
     runTest("someOtherTestFunctionA");
     runTest("someOtherTestFunctionB");
}


//This is the reusable function that will load generic data and call the function 
function runTest(myFunction){
    var testQuery = "ABC";
    var testResult = "EFG";
    myFunction(testQuery, testResult); //This is the area that I'm not sure is possible
}


//each project will have unique tests that they can configure using the …
Run Code Online (Sandbox Code Playgroud)

javascript parameters jquery function parameter-passing

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

IE8中的JSON对象无效,但Chrome中无效

为什么这个JSON在ie8中无效,但在firefox或chrome中无效?在我的回调中,我解析结果以使用jquery解析器删除一些无效字符.

myStringResults = myStringResults.replace("},]","}]");
myStringResults = myStringResults.replace(/'/g,'"');
var objDoc = $.parseJSON(myStringResults);
Run Code Online (Sandbox Code Playgroud)

消息:无效的JSON:

[{"id":"4796","parent":"4796","name":"Fname","revision":"1","date":"2013年3月1日下午3:44:22" ,"作者":"席尔瓦,杰弗瑞M","文件名":"C:\ Users\jmsilva\Desktop\VOC pres.pdf","type":"0"},{"id":"4797", "parent":"4797","name":"Fname","revision":"1","date":"2013年3月1日下午3:50:46","作者":"Silva,Jeffery M ", "文件名": "C:\用户\ jmsilva \桌面\ testUpload.doc", "类型": "0"}]

jquery parsing json internet-explorer-8

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

当它应该是"发布"请求时,为什么我会收到"获取"请求

我正在尝试提交下面的表单来上传文件,但是每当我提交表单时,来自的请求都是'GET REQUEST'.这只是我的浏览器有问题吗?

<form enctype="multipart/form-data" id="frmUploadDoc2" target="hiddenIframe" method=”POST” action="/rest/wle">
   <input id="myFileName" type="file" name="data" />
   <input type="text" name="action" value="addDocument" />
   <input type="text" name="accept" value="application/json" />
   <input type="text" name="parts" value="none" />
   <input type="text" name="name" value="myTestQ1" />
   <input type="text" name="docType" value="file" />
   <input type="submit" value="Submit"/>
</form>
<iframe name="hiddenIframe" id="hiddenIframe" style="display: none;">
Run Code Online (Sandbox Code Playgroud)

html forms post get request

0
推荐指数
2
解决办法
87
查看次数

jquery无法从input元素中获取值

我正在使用jquery尝试检索文本输入的值,但它无法正常工作.谁能看到我做错了什么?http://jsfiddle.net/silvajeff/rJNLr/

<input id="mytest2" value="123"/>
<button id="findRow">Find Row</button>

$("#findRow").click(function() {   
  var theVal = $("#myTest2").val();
  alert(theVal);
});
Run Code Online (Sandbox Code Playgroud)

我向所有人道歉,但我最初发布的内容只是一个错字,当我打破这个问题以简化它时.我将不得不重新发布,只是这次我将把未经简化的代码放在这里.我会在这里留下这个问题并添加一个区分大小写的标签,因为我仍然认为这些对于可能存在问题的其他人来说是有价值的解决方案.

jquery select text input case-sensitive

0
推荐指数
3
解决办法
3600
查看次数