I'm using the pre tag right now to format JSON's I'm displaying. However, I want to hide the block when I'm not using it. I'm not sure how to do that.
答案 0 :(得分:0)
听起来像基本的CSS和JS。向{"past_orders":
[{"order_id":"1","order_date":"2012-12-27", "products":["product_id":"1","price":"12.40"},"product_id":"2","price":"32.00"},"product_id":"3","price":"25.00"}],
{"order_id":"3","order_date":"2016-01-12","products":["product_id":"1","price":"12.40"},{"product_id":"6","price":"28.00"},{"product_id":"7","price":"37.00"}],
{"order_id":"4","order_date":"2014-04-06","products":["product_id":"1","price":"12.40"},{"product_id":"2","price":"32.00"},{"product_id":"5","price":"13.50"}]}
添加ID或类,并使用填充它的函数来显示<pre>
。如果你有一个空函数,它会隐藏<pre>
,如<pre>
中的CSS