我有一個巨大的頁面,但我已經recconstructed錯誤的JS FIDDLE與PHP變量HTML類名
<li><input class="<?php echo $env;?>" type="checkbox" > This is Item 1</li>
這是有錯誤的行。
它沒有讀取類名,因爲變量是否相等?
我錯過了什麼,或者你不能這樣做?
我有一個巨大的頁面,但我已經recconstructed錯誤的JS FIDDLE與PHP變量HTML類名
<li><input class="<?php echo $env;?>" type="checkbox" > This is Item 1</li>
這是有錯誤的行。
它沒有讀取類名,因爲變量是否相等?
我錯過了什麼,或者你不能這樣做?
更改您的HTML作爲
<body>
<a href="http://jquery.com/">jQuery</a>
<?php $env = "env" ?>
<ul class="chk-container">
<li><input class="selecctall" type="checkbox"> Selecct All</li>
<li><input class="<?php echo $env;?>" type="checkbox" > This is Item 1</li>
<li><input class="checkbox1" type="checkbox" > This is Item 2</li>
<li><input class="checkbox1" type="checkbox" > This is Item 3</li>
<li><input class="checkbox1" type="checkbox" > This is Item 4</li>
<li><input class="checkbox1" type="checkbox" > This is Item 5</li>
<li><input class="checkbox1" type="checkbox" > This is Item 6</li>
<li><input class="checkbox2" type="checkbox" > Do not select this</li>
</ul>
</body>
的問題是,你是不是關閉PHP的標籤
抱歉,這只是一個複製和粘貼問題,這不是實際問題抱歉 – RixsonL
檢查這部分<?php $ env =「env」?>。有什麼區別? –
接近它' –
dachi
您是否已將您的代碼複製並粘貼到JSFiddle中?因爲你沒有關閉你的第一個PHP標籤。 – George
JSFiddle無法運行PHP。 [相似主題](http://stackoverflow.com/questions/4616159/is-there-a-php-sandbox-something-like-jsfiddle-is-to-js) – Vucko