Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pass html block as parameter

I know this is a very simple question , I want to know how to pass a html block as a para meter to a function and call that function on very moment that page load .

<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&nbsp;</p>\n<p>hehe told u&nbsp;</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>&nbsp;xxxx</td>\n</tr>\n<tr>\n<td>Less: income tax (£35,000 x 25%)</td>\n<td>&nbsp;xxxx</td>\n</tr>\n<tr>\n<td>Less: social security tax (£50,000 x 9%)</td>\n<td>&nbsp;xxxx</td>\n</tr>\n<tr>\n<td>Net earnings</td>\n<td>&nbsp;xxxx</td>\n</tr>\n<tr>\n<td>Employer’s contribution on social security<br>(£50,000 x10.5%)</td>\n<td>&nbsp;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>

and I want to pass the following html block to my function as a parameter

  <p>loruim epsum haha&nbsp;</p>\n<p>hehe told u&nbsp;</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>&nbsp;xxxx</td>\n</tr>\n<tr>\n<td>Less: income tax (£35,000 x 25%)</td>\n<td>&nbsp;xxxx</td>\n</tr>\n<tr>\n<td>Less: social security tax (£50,000 x 9%)</td>\n<td>&nbsp;xxxx</td>\n</tr>\n<tr>\n<td>Net earnings</td>\n<td>&nbsp;xxxx</td>\n</tr>\n<tr>\n<td>Employer’s contribution on social security<br>(£50,000 x10.5%)</td>\n<td>&nbsp;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>

any idea howto do that ?

note this has jquery mobile structures

like image 836
Piumal Chamath Avatar asked Feb 04 '26 08:02

Piumal Chamath


1 Answers

function yourFunction(htmlBlock){
  // your code
}

// call function and pass Jquery object
yourFunction($('section[data-role="conents"]'));
// call function and pass html code of object
yourFunction($('section[data-role="conents"]').html());
like image 145
maximkou Avatar answered Feb 06 '26 21:02

maximkou



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!