CSS选择元素属性或属性为nth-of-type

时间:2016-09-24 15:24:18

标签: html css attributes css-selectors

我希望选择具有required属性或type='submit'的所有输入,然后使用nth-of类型迭代它们。

类似于:(input[required]|[type='submit']):nth-of-type(1)

示例:

4个必需的输入,然后是两个非必需的,然后提交。

匹配(必需或提交)的第一个是绿色,第二个是蓝色,第三个是黄色,第四个是橙色,第五个是红色等。

1 个答案:

答案 0 :(得分:3)

虽然管道(||)符号表示" OR"在几种编程语言中(尽管它通常是input[required], input[type="submit"]{ box-shadow: 5px 5px 5px red; })和W3C specification syntax中,它在CSS中没有那种含义。

"OR" can be expressed by a comma in CSS



<input type="text"><br>
<input type="radio"><br>
<input type="checkbox" required><br>
<input type="submit">
&#13;
    abc= "rajasthan";
    xml_ajax(abc);

 //xml_ajax(text.gettext.tostring)

}

public void xml_ajax(String abc) {
    AQuery aq = new AQuery(this);
    aq.progress(R.id.progressBar1).ajax(URL, JSONObject.class, this, "getJobs");
}

public void getJobs(String url, JSONObject json, AjaxStatus status) {
    Arrcateg = new ArrayList<String>();
    Arrcatvalue = new ArrayList<String>();
    if (json != null) {
        Arrcatvalue.add("--Select--");
        Arrcatvalue.add("0");
        JSONArray info = null;
        try {
            info = json.getJSONArray("Native");
            if (info.length() == 0) {
                Toast.makeText(this, "No Faltu Data Founds", Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(this, "success", Toast.LENGTH_LONG).show();
                for (int i = 0; i < info.length(); i++) {
                    JSONObject info1 = info.getJSONObject(i);
                    Arrcateg.add(info1.getString("tId"));
                    Arrcatvalue.add(info1.getString("AllInOne"));
                }

                Log.d("aaa",Arrcatvalue+"");
                spinneradapterProduct = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, Arrcatvalue);
                spinneradapterProduct.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                text.setAdapter(spinneradapterProduct);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    } else {
        Toast.makeText(this,"unsuccess to access",Toast.LENGTH_LONG).show();
    }
}
&#13;
&#13;
&#13;

相关问题