小编Jer*_*hrs的帖子

如何在逗号上分割一个后面没有空格的字符串?

我希望结果是:

Cats, Felines & Cougars    
Dogs    
Snakes
Run Code Online (Sandbox Code Playgroud)

这是我能得到的最接近的。

$string = "Cats, Felines & Cougars,Dogs,Snakes";
$result = split(',[^ ]', $string);
print_r($result);
Run Code Online (Sandbox Code Playgroud)

这导致

Array
(
    [0] => Cats, Felines & Cougars
    [1] => ogs
    [2] => nakes
)
Run Code Online (Sandbox Code Playgroud)

php regex preg-split

8
推荐指数
2
解决办法
1463
查看次数

Twitter Bootstrap跨越了溢出

http://jsfiddle.net/jgehrs/MgcDU/3103/

我有这个代码块,它应该导致4个相同大小的跨度全部水平排列,但正如您所看到的,第4个块被推下到新行.我现在已经使用了bootstrap几天了,这是我第一次见到这个.

<div id='middle' class='row'>
  <div class='span3'>
    <div>1</div>
  </div>
  <div class='span3'>
    <div>2</div>
  </div>
  <div class='span3'>
    <div>3</div>
  </div>
  <div class='span3'>
    <div>4</div>
  </div>
Run Code Online (Sandbox Code Playgroud)

跨越溢出

编辑:这是一个显示问题的jsFiddle.

twitter-bootstrap

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

Casperjs:测试jquery自动完成

我无法与带有casperjs的jquery自动完成输入框进行交互.我尝试了很多不同的方法,但是当弹出选项列表时,我似乎无法选择自动完成选项.

我的代码如下:

casper.thenEvaluate(function() {
  $('#myInput').val('cars');  // fill in the text box
  $('#myInput').blur();  // should trigger the autocomplete ajax call
  $('.ui-autocomplete li.ui-menu-item:nth-of-type(1)').click(); // should click the first item in the list
});

// take a picture to make sure it worked
casper.then(function() {
  this.captureSelector('pics/test1.png', '#theForm');
});
Run Code Online (Sandbox Code Playgroud)

这根本不起作用,即使看起来应该如此.通过玩弄它,我发现触发向下箭头按键几次触发自动完成显示,所以这是一个更接近工作的版本.这适用于浏览器,但由于某种原因不适用于casper.thenEvaluate块.

$('#myInput').val('cars');  // fill in the text box
var e = jQuery.Event("keydown");
e.which = 40; // press down arrow a few times, not sure why this works
$("#myInput").trigger(e);
$("#myInput").trigger(e);
$('.ui-autocomplete li.ui-menu-item:nth-of-type(1)').click();
Run Code Online (Sandbox Code Playgroud)

jquery browser-automation browser-testing jquery-autocomplete casperjs

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