dongsha2792 2015-10-25 22:57
浏览 22

JS Prepend语句可以编辑预定义的html吗?

I define my html by setting it equal to a variable i am echoing, just for the sake of keeping my php page dynamic, however i am trying to append another input div onto my text area once a button is clicked via a javascript statement. In terms of syntax i cant seem to find any errors, is this just not allowed?

this is the code for my comment area,

 $comment_ui = '<textarea id="statustext" onkeyup="statusMax(this,250)"       onfocus="showBtnDiv()" placeholder="What&#39;s new with you '.$u.'?"></textarea>';
 $comment_ui .= '<div id="uploadDisplay_SP"></div>';
 $comment_ui .= '<div id="btns_SP" class="hiddenStuff">';
    $comment_ui .= '<form action=""><input id="gendercheck" type="checkbox" name="male"  onclick="gendertoggle()">male</form>';
    $comment_ui .= '<img src="images/topic.JPG" id="triggerTopic" class="triggerBtn" onclick="showtitleDiv" width="137" height="22" title="Add a title" />';
    $comment_ui .= '<button id="statusBtn" onclick="postToStatus(\'status_post\',\'c\',\''.$u.'\',\'statustext\',\''.$male.'\',\'title\')">Post</button>';
    $comment_ui .= '<img src="images/camera.JPG" id="triggerBtn_SP" class="triggerBtn" onclick="triggerUpload(event, \'fu_SP\')" width="137" height="22" title="Upload A Photo" />';        
    $status_ui .= '</div>';

notice i included an image icon for adding a topic to a comment that on click calls this function

 function showtitleDiv(){
    _("statustext").prepend('<input id="title" onkeyup="statusMax(this,30)" placeholder="Topic headline..."><br />');
   /*_("triggerTopic").style.display = "block";*/
  }

and i echo the $comment_ui in the body of my document, everything shows, and the comments work, its just the showtitleDiv function isnt working

the javascipt console doesnt show any errors, is the syntax wrong? I appreciate any and all of your expertise!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line