dongsui8162 2015-05-29 09:47
浏览 22

提取元素的HTML

I am trying to get the internal HTML of an HTML Tag, how can i do this so far i have tried this

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
    var x = parseInt("123");
    $("#getVal").html(x);
});

</script>
<?php
    $s = '<p id="getVal"></p>';
    echo strpos($s, ">");
    echo substr($s,15);

    $s = intval($s);
    echo gettype($s);
    echo intval($s)*2;
?>

after the last echo in php i just get 0 as result what i should i do to get the results. Ok I want to do is sending some numeric data from JS to PHP and then after performing some numerical operations on it i want to return that user, on the same page. I dont want to use AJAX.

  • 写回答

3条回答 默认 最新

  • douzhicai7148 2015-05-29 09:48
    关注

    If you want to extract the html, simply do

    $("#getVal").html();
    

    without passing any parameters to html()

    If you want to extract the text, simply do

    $("#getVal").text();
    

    without passing any parameters to text()

    评论

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号