我有這個代碼,我想知道如何設置ID值爲<h4>
,並知道該ID是否有效。這是一個有效的ID?
container.insert({ bottom: '<h4 style="margin:8px 0px 4px 0px; padding-left:0px ; select id=comment_'+ l +'">' + l + '</h4>' });
我需要這個,所以我可以隱藏/顯示此<h4>
取決於組合框的值。
還是有更簡單的方法來做到這一點?
我有這個代碼,我想知道如何設置ID值爲<h4>
,並知道該ID是否有效。這是一個有效的ID?
container.insert({ bottom: '<h4 style="margin:8px 0px 4px 0px; padding-left:0px ; select id=comment_'+ l +'">' + l + '</h4>' });
我需要這個,所以我可以隱藏/顯示此<h4>
取決於組合框的值。
還是有更簡單的方法來做到這一點?
您在H4屬性似乎是畸形的,解釋爲什麼你不能用一個id選擇導航至H4
<h4 style="margin:8px 0px 4px 0px; padding-left:0px ; select id=comment_'+ l +'">
應該
<h4 style="margin:8px 0px 4px 0px; padding-left:0px;" id="comment_'+ l +'">
你可以給你喜歡的任何元素,甚至腳本/鏈接/頭和其他標籤的id屬性。
您可以將ID添加到您喜歡的任何元素。至於它的有效性:
ID和名稱標記必須以字母([A-ZA-Z])開始,並且可以是 後跟任意數量的字母,數字([0-9]),連字符(「 - 」), 下劃線(「_」),冒號(「:」)和句點(「。」)。
但是當我嘗試通過身份證的元素我什麼也沒有得到 – user181891 2012-04-13 14:18:17
中有什麼'l'變量? – 2012-04-13 14:11:37
它是一個類別的名稱 – user181891 2012-04-13 14:13:22
你可能想看到這個問題,http://stackoverflow.com/questions/70579/what-are-valid-values-for-the-id-attribute-in-html – 2012-04-13 14:13:35