dongse3348 2010-10-27 12:52
浏览 200

将多行字符串值提供给jquery方法

How do I feed string variable holding multiline value in it to jquery method like prepend? I need it to construct a form pass by drupal search module like - $('#divsearch').prepend('<?php print $search_box; ?>'). Thanks a bunch.

  • 写回答

2条回答

  • duanmei1946 2010-10-27 13:00
    关注

    I think the problem is that you can have carriage returns or new lines in you string lets take out the php and show what i mean

    $('#divsearch').prepend('<div />');
    

    this would work

    $('#divsearch').prepend('<div>some text that goes 
          in a div</div>'); 
    

    this does not work

    $('#divsearch').prepend('<div>some text that goes'+
          'in a div</div>'); 
    

    this woould

    评论

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大