我知道這是一個非常簡單的問題,我想知道如何將html塊作爲參數傳遞給函數,並在頁面加載時立即調用該函數。傳遞html塊作爲參數
<body>
<section data-role="page" data-theme="ams">
<section data-role="header" id="content">
<h1>header ssssssssssssssssssssssssssssss sssssssssssssssssssssss ssssssssssssssssssssssssss ssssssssssssssss ssssssssssss</h1>
</section>
<section data-role="conents" >
<p>loruim epsum haha </p>\n<p>hehe told u </p>\n<ol class=\"starpasspro-upper-alpha_ol\">\n<li>gasdfg</li>\n<li>sdfffasd</li>\n<li>asdfffasdf</li>\n<li>asdfasdfasdfasd</li>\n</ol>\n\n<table class=\"table_with_header lsm-tableclass-styles\">\n<tbody>\n<tr>\n<td class=\"lsm_table_heading_1\">Description</td>\n<td class=\"lsm_table_heading_1\">Amount</td>\n</tr>\n<tr>\n<td>Gross salary</td>\n<td> xxxx</td>\n</tr>\n<tr>\n<td>Less: income tax (£35,000 x 25%)</td>\n<td> xxxx</td>\n</tr>\n<tr>\n<td>Less: social security tax (£50,000 x 9%)</td>\n<td> xxxx</td>\n</tr>\n<tr>\n<td>Net earnings</td>\n<td> xxxx</td>\n</tr>\n<tr>\n<td>Employer’s contribution on social security<br>(£50,000 x10.5%)</td>\n<td> xxxx</td>\n</tr>\n</tbody>\n</table>\n\n
<p><span data-lscp-resource-mimetype=\"image/png\" data-lscp-resource-id=\"51e8db617607942807000032\"></span></p>
</section>
<section data-role="footer">
<p>footer</p>
</section>
</section>
,我想下面的HTML塊傳遞給我的函數作爲參數
<p>loruim epsum haha </p>\n<p>hehe told u </p>\n<ol class=\"starpasspro-upper-alpha_ol\">\n<li>gasdfg</li>\n<li>sdfffasd</li>\n<li>asdfffasdf</li>\n<li>asdfasdfasdfasd</li>\n</ol>\n\n<table class=\"table_with_header lsm-tableclass-styles\">\n<tbody>\n<tr>\n<td class=\"lsm_table_heading_1\">Description</td>\n<td class=\"lsm_table_heading_1\">Amount</td>\n</tr>\n<tr>\n<td>Gross salary</td>\n<td> xxxx</td>\n</tr>\n<tr>\n<td>Less: income tax (£35,000 x 25%)</td>\n<td> xxxx</td>\n</tr>\n<tr>\n<td>Less: social security tax (£50,000 x 9%)</td>\n<td> xxxx</td>\n</tr>\n<tr>\n<td>Net earnings</td>\n<td> xxxx</td>\n</tr>\n<tr>\n<td>Employer’s contribution on social security<br>(£50,000 x10.5%)</td>\n<td> xxxx</td>\n</tr>\n</tbody>\n</table>\n\n
<p><span data-lscp-resource-mimetype=\"image/png\" data-lscp-resource-id=\"51e8db617607942807000032\"></span></p>
任何想法HOWTO做到這一點?
注意到這有jQuery Mobile的結構
你可以發佈你的功能嗎?或版本。 – Toiletduck
@ChamZ,我認爲,你可以綁定代碼中的部分,即'$ mycodeblock ='
loruim epsum haha&...「>
',然後將這個$ mycodeblock作爲參數發送給你的函數,這可能對你有幫助。 –