English 中文(简体)
j 质量检查箱 浮雕(需要)
原标题:jQuery Checkbox Click Sync (Regex needed)

我有两个检查箱组,我最终需要一个小组来影响另一个小组的产出。 页: 1 问题/回答似乎使我处于一般方向,但有一些<代码>regex。 在此需要,我不熟悉其中的内容。

第一个检查箱组:

<div class="tabs-panel" id="wood_types-all" style="display: block;">
    <input type="hidden" value="0" name="tax_input[wood_types][]">
    <ul class="list:wood_types categorychecklist form-no-clear" id="wood_typeschecklist">
        <li class="popular-category" id="wood_types-33"><label class="selectit"><input type="checkbox" id="in-wood_types-33" name="tax_input[wood_types][]" value="33"> Clear Pine</label></li>
        <li class="popular-category" id="wood_types-35"><label class="selectit"><input type="checkbox" checked="checked" id="in-wood_types-35" name="tax_input[wood_types][]" value="35"> Oak</label></li>
        <li class="popular-category" id="wood_types-34"><label class="selectit"><input type="checkbox" checked="checked" id="in-wood_types-34" name="tax_input[wood_types][]" value="34"> Poplar</label></li>
        <li class="popular-category" id="wood_types-36"><label class="selectit"><input type="checkbox" id="in-wood_types-36" name="tax_input[wood_types][]" value="36"> PVC</label></li>
    </ul>
</div>

The value I am trying to extract and compare is (for example), the 33 in id="wood_types-33"

其他检查箱组是:

<div class="field field-categories" id="acf-mp_wood_species_availability"><label for="fields[field_4f7f4709cdb16]" class="field_label">Wood Species Availability</label>
    <ul>
        <li>
            <input type="checkbox" class="33" value="clear-pine" name="fields[field_4f7f4709cdb16][]" id="fields[field_4f7f4709cdb16][]">&nbsp;Clear Pine
        </li>
        <li>
            <input type="checkbox" class="34" value="poplar" name="fields[field_4f7f4709cdb16][]" id="fields[field_4f7f4709cdb16][]">&nbsp;Poplar
        </li>
        <li>
            <input type="checkbox" checked="" class="35" value="oak" name="fields[field_4f7f4709cdb16][]" id="fields[field_4f7f4709cdb16][]">&nbsp;Oak
        </li>
        <li>
            <input type="checkbox" class="36" value="pvc" name="fields[field_4f7f4709cdb16][]" id="fields[field_4f7f4709cdb16][]">&nbsp;PVC         
        </li>
    </ul>
</div>

因此,两个核对箱组的确具有共同特性:id=“wood_types-33”}=“33”

我最后试图做的是,通过违约隐藏了第二套检查箱(我知道可以做):

$( #acf-mp_wood_species_availability li ).hide();

如果选定第一个核对箱组的配对项目,则可以选择第二组(未选定为show(<>)。 I m还试图将其“忽略”放在页数上(如果有人回过来,可以选择项目),如果第一个核对箱子组的一个项目(在选定之后)被放弃,那么第二个核对箱子项目不仅应当消失,而且应当停止(可以通过<代码>click(<>click(>>)。 我是在这样的时候,而且很幸运,因此,任何帮助都会得到真正的赞赏。 感谢!

starter jFiddle: http://jsfiddle.net/JfwWv/

我看到,该是jQuery regex的che子,但我看不到 function>)的任何参考资料;我只是想到这个错误之处,是普通选子公司(>>>c>/code>?

最佳回答
var numberToCompare = "#wood_types-33".split("-")[1];

基本来说,请打电话.split(>,说明返回情况,根据你具体描述的特性进行了一系列的这种划分。 在这种情况下,wood_types-33”.split(“-”)回收了两套指数,即“-”之前和之后出现的情况。 我们需要的是之后的内容;因此,?

这样做可以更快:

var myStr = "#wood_types-33";
myStr = myStr.substr(myStr.lastIndexOf("-")+1);

但是,要解释一点小.。 它只是工作。

问题回答

暂无回答




相关问题
Uncommon regular expressions [closed]

Recently I discovered two amazing regular expression features: ?: and ?!. I was curious of other neat regex features. So maybe you would like to share some tricky regular expressions.

regex to trap img tag, both versions

I need to remove image tags from text, so both versions of the tag: <img src="" ... ></img> <img src="" ... />

C++, Boost regex, replace value function of matched value?

Specifically, I have an array of strings called val, and want to replace all instances of "%{n}%" in the input with val[n]. More generally, I want the replace value to be a function of the match ...

PowerShell -match operator and multiple groups

I have the following log entry that I am processing in PowerShell I m trying to extract all the activity names and durations using the -match operator but I am only getting one match group back. I m ...

Is it possible to negate a regular expression search?

I m building a lexical analysis engine in c#. For the most part it is done and works quite well. One of the features of my lexer is that it allows any user to input their own regular expressions. This ...

regex for four-digit numbers (or "default")

I need a regex for four-digit numbers separated by comma ("default" can also be a value). Examples: 6755 3452,8767,9865,8766,3454 7678,9876 1234,9867,6876,9865 default Note: "default" ...