如何识别IFRAME中的表单元素

时间:2012-03-08 01:51:55

标签: jquery iframe input textarea prettyphoto

我正在尝试确定value中的<input type="text"><textarea>中的值是否发生更改,以便我可以启动对服务器的AJAX调用。该脚本只是循环显示每个id,而不仅仅是当前IFRAME中的那些。

我知道如何进行AJAX调用和后端脚本编写,我无法弄清楚如何在任何给定的prettyPhoto {{1}中更改表单元素的value }。我的prettyPhoto帧是动态创建的,IFRAME中有超过800个元素。

我有以下jQuery:

FORM

非常感谢任何想法或帮助。

jQuery.support.cors = true; // Needed for AJAX to work in certain older browsers and versions

$(document).ready(function(){

    // load each PP Frame
    $('a[rel^="prettyPhoto"]').prettyPhoto({
        social_tools: false,
        changepicturecallback: function() {
            var abc = $('input.inputText').val();
            alert(abc);
        }
    });

}); // end .ready()

P.S。我知道如何使用样式表,并在完成开发后将所有样式移动到工作表中。我在开发过程中有内联样式的诀窍(可能是个坏习惯),因为事情变化太频繁,而且我更喜欢一次处理1个文档。

接下来尝试使用[at] JF的回答

<form id="my-form" name="my-form"><div class="rowhighlight" style="clear:both">

<div style="clear:both">
    <p style="float:left;width:40px;text-align:right;background-color:inherit;margin:0;padding:0;margin-left:60px;padding-right:10px;"><a href="#n0076-1" rel="prettyPhoto[n0076]" title="App Title<br />2012">76</a></p>
    <div style="display:none;">
        <a href="#n0076-2" rel="prettyPhoto[n0076]" title="App Title<br />2012"></a>
        <a href="#n0076-3" rel="prettyPhoto[n0076]" title="App Title<br />2012"></a>
        <a href="#n0076-4" rel="prettyPhoto[n0076]" title="App Title<br />2012"></a>
    </div>
    <p style="float:left;width:240px;background-color:inherit;margin:0;padding:0;color:inherit;">Person 76</p>
    <p style="float:left;width:240px;background-color:inherit;margin:0;padding:0;color:inherit;">Person 76-A<span style="font-size:0.8125em;padding-left:8px;">(Type)</span></p>
    <p style="float:left;width:180px;background-color:inherit;margin:0;padding:0;color:inherit;">3/1/12 at 10:22am (Thu)</p>
    <p style="float:left;width:60px;text-align:right;background-color:inherit;margin:0;padding:0;color:inherit;">0</p>
    <p style="float:left;width:60px;text-align:right;background-color:inherit;margin:0;padding:0;color:inherit;padding-right:10px;">0.00</p>
</div>

<div id="n0076-1" style="display:none;width:600px;">
<h1 style="float:left;margin:6px 0 8px 6px;padding:0;border:none;">Header 1</h1>
<h2 style="float:right;margin:9px 8px; 8px 0;padding:0;border:none;">Header 2</h2>
<div style="clear:both;margin:0 6px;padding:4px 10px;background-color:#dedede">

    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888">Name 1:</span> <span style="font-weight:bold">Person 76</span></p>
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888;padding-right:11px">Name 2:</span>Person 76-A (Type)&nbsp;&nbsp;&bull;&nbsp;&nbsp;Description</p>
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888;padding-right:9px">Date:</span> March 1, 2012 at 10:22am</p>
</div>

<div style="color:#333;text-align:left;padding-left:4px;margin:0;padding-right:10px;font-size:0.875em;line-height:1.375em;margin-top:10px">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer a magna et massa ultrices porta ut a sem. Nulla eu mauris eget nunc sagittis ornare. Mauris convallis posuere nisi, non posuere turpis mattis ut. Quisque venenatis, dolor ac placerat posuere, velit purus adipiscing libero, eu suscipit nibh justo non nunc. Praesent non odio in nunc tempus volutpat sed ac metus. Nam eleifend adipiscing ipsum, ultricies adipiscing purus accumsan eu. Nulla tincidunt tincidunt varius. Sed non aliquet nunc. Mauris in pulvinar eros. Ut elementum pulvinar interdum. Fusce pulvinar posuere sollicitudin. Nam ultricies auctor sapien, quis eleifend ipsum pharetra hendrerit.</div><!--start form 1-->
<div style="margin-top:36px;display:block"><input class="textInput" id="es_user_2012_0076_1" type="text" value="0" style="float:left;margin:0 2px 0 2px;padding:0;width:60px;height:60px;border:1px solid #999;color:#777;text-align:center;font-size:3.5em;" /><textarea class="noteInput" onFocus="$(this).val('')" id="en_user_2012_0076_1" style="float:left;margin:0 2px 0 2px;padding:2px;width:424px;height:56px;border:1px solid #999;color:#369;text-align:left;font-size:0.75em;">In box to left, enter 1-5 (1=low &amp; 5=high). Use this box for optional notes.</textarea></div>
<!--end form 1-->
<div style="clear:both;"></div></div> <!-- end 0076-1 -->
<div id="n0076-2" style="display:none;width:600px;">
<h1 style="float:left;margin:6px 0 8px 6px;padding:0;border:none;">Header 1</h1>
<h2 style="float:right;margin:9px 8px; 8px 0;padding:0;border:none;">Header 2</h2>
<div style="clear:both;margin:0 6px;padding:4px 10px;background-color:#dedede">
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888">Name 1:</span> <span style="font-weight:bold">Person 76</span></p>

    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888;padding-right:11px">Name 2:</span>Person 76-A (Type)&nbsp;&nbsp;&bull;&nbsp;&nbsp;Description</p>
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888;padding-right:9px">Date:</span> March 1, 2012 at 10:22am</p>
</div>
<div style="color:#333;text-align:left;padding-left:4px;margin:0;padding-right:10px;font-size:0.875em;line-height:1.375em;margin-top:10px">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer a magna et massa ultrices porta ut a sem. Nulla eu mauris eget nunc sagittis ornare. Mauris convallis posuere nisi, non posuere turpis mattis ut. Quisque venenatis, dolor ac placerat posuere, velit purus adipiscing libero, eu suscipit nibh justo non nunc. Praesent non odio in nunc tempus volutpat sed ac metus. Nam eleifend adipiscing ipsum, ultricies adipiscing purus accumsan eu. Nulla tincidunt tincidunt varius. Sed non aliquet nunc. Mauris in pulvinar eros. Ut elementum pulvinar interdum. Fusce pulvinar posuere sollicitudin. Nam ultricies auctor sapien, quis eleifend ipsum pharetra hendrerit.</div><!--start form 2-->
<div style="margin-top:36px;display:block"><input class="textInput" id="es_user_2012_0076_2" type="text" value="0" style="float:left;margin:0 2px 0 2px;padding:0;width:60px;height:60px;border:1px solid #999;color:#777;text-align:center;font-size:3.5em;" /><textarea class="noteInput" onFocus="$(this).val('')" id="en_user_2012_0076_2" style="float:left;margin:0 2px 0 2px;padding:2px;width:424px;height:56px;border:1px solid #999;color:#369;text-align:left;font-size:0.75em;">In box to left, enter 1-5 (1=low &amp; 5=high). Use this box for optional notes.</textarea></div>
<!--end form 2-->

<div style="clear:both;"></div></div> <!-- end 0076-2 -->
<div id="n0076-3" style="display:none;width:600px;">
<h1 style="float:left;margin:6px 0 8px 6px;padding:0;border:none;">Header 1</h1>
<h2 style="float:right;margin:9px 8px; 8px 0;padding:0;border:none;">Header 2</h2>
<div style="clear:both;margin:0 6px;padding:4px 10px;background-color:#dedede">
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888">Name 1:</span> <span style="font-weight:bold">Person 76</span></p>
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888;padding-right:11px">Name 2:</span>Person 76-A (Type)&nbsp;&nbsp;&bull;&nbsp;&nbsp;Description</p>

    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888;padding-right:9px">Date:</span> March 1, 2012 at 10:22am</p>
</div>
<div style="color:#333;text-align:left;padding-left:4px;margin:0;padding-right:10px;font-size:0.875em;line-height:1.375em;margin-top:10px">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer a magna et massa ultrices porta ut a sem. Nulla eu mauris eget nunc sagittis ornare. Mauris convallis posuere nisi, non posuere turpis mattis ut. Quisque venenatis, dolor ac placerat posuere, velit purus adipiscing libero, eu suscipit nibh justo non nunc. Praesent non odio in nunc tempus volutpat sed ac metus. Nam eleifend adipiscing ipsum, ultricies adipiscing purus accumsan eu. Nulla tincidunt tincidunt varius. Sed non aliquet nunc. Mauris in pulvinar eros. Ut elementum pulvinar interdum. Fusce pulvinar posuere sollicitudin. Nam ultricies auctor sapien, quis eleifend ipsum pharetra hendrerit.</div><!--start form 3-->
<div style="margin-top:36px;display:block"><input class="textInput" id="es_user_2012_0076_3" type="text" value="0" style="float:left;margin:0 2px 0 2px;padding:0;width:60px;height:60px;border:1px solid #999;color:#777;text-align:center;font-size:3.5em;" /><textarea class="noteInput" onFocus="$(this).val('')" id="en_user_2012_0076_3" style="float:left;margin:0 2px 0 2px;padding:2px;width:424px;height:56px;border:1px solid #999;color:#369;text-align:left;font-size:0.75em;">In box to left, enter 1-5 (1=low &amp; 5=high). Use this box for optional notes.</textarea></div>
<!--end form 3-->
<div style="clear:both;"></div></div> <!-- end 0076-3 -->
<div id="n0076-4" style="display:none;width:600px;">
<h1 style="float:left;margin:6px 0 8px 6px;padding:0;border:none;">Header 1</h1>
<h2 style="float:right;margin:9px 8px; 8px 0;padding:0;border:none;">Header 2</h2>

<div style="clear:both;margin:0 6px;padding:4px 10px;background-color:#dedede">
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888">Name 1:</span> <span style="font-weight:bold">Person 76</span></p>
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888;padding-right:11px">Name 2:</span>Person 76-A (Type)&nbsp;&nbsp;&bull;&nbsp;&nbsp;Description</p>
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888;padding-right:9px">Date:</span> March 1, 2012 at 10:22am</p>

</div>
<div style="color:#333;text-align:left;padding-left:4px;margin:0;padding-right:10px;font-size:0.875em;line-height:1.375em;margin-top:10px"><span class="ltOrange">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer a magna et massa ultrices porta ut a sem. Nulla eu mauris eget nunc sagittis ornare. Mauris convallis posuere nisi, non posuere turpis mattis ut. Quisque venenatis, dolor ac placerat posuere, velit purus adipiscing libero, eu suscipit nibh justo non nunc. Praesent non odio in nunc tempus volutpat sed ac metus. Nam eleifend adipiscing ipsum, ultricies adipiscing purus accumsan eu. Nulla tincidunt tincidunt varius. Sed non aliquet nunc. Mauris in pulvinar eros. Ut elementum pulvinar interdum. Fusce pulvinar posuere sollicitudin. Nam ultricies auctor sapien, quis eleifend ipsum pharetra hendrerit.</span></div><div style="clear:both;border-bottom:1px solid #ccc;padding-top:20px;"></div></div> <!-- end 0076-4 -->
<div class="rowhighlight" style="clear:both">

    <p style="float:left;width:40px;text-align:right;background-color:inherit;margin:0;padding:0;margin-left:60px;padding-right:10px;"><a href="#n0108-1" rel="prettyPhoto[n0108]" title="App Title<br />2012">108</a></p>
    <div style="display:none;">
        <a href="#n0108-2" rel="prettyPhoto[n0108]" title="App Title<br />2012"></a>
        <a href="#n0108-3" rel="prettyPhoto[n0108]" title="App Title<br />2012"></a>
        <a href="#n0108-4" rel="prettyPhoto[n0108]" title="App Title<br />2012"></a>
    </div>
    <p style="float:left;width:240px;background-color:inherit;margin:0;padding:0;color:inherit;">Person 108</p>
    <p style="float:left;width:240px;background-color:inherit;margin:0;padding:0;color:inherit;">Person 108-A<span style="font-size:0.8125em;padding-left:8px;">(Type)</span></p>
    <p style="float:left;width:180px;background-color:inherit;margin:0;padding:0;color:inherit;">3/2/12 at 11:12pm (Fri)</p>
    <p style="float:left;width:60px;text-align:right;background-color:inherit;margin:0;padding:0;color:inherit;">0</p>
    <p style="float:left;width:60px;text-align:right;background-color:inherit;margin:0;padding:0;color:inherit;padding-right:10px;">0.00</p>
</div>

<div id="n0108-1" style="display:none;width:600px;">
<h1 style="float:left;margin:6px 0 8px 6px;padding:0;border:none;">Header 1</h1>
<h2 style="float:right;margin:9px 8px; 8px 0;padding:0;border:none;">Header 2</h2>
<div style="clear:both;margin:0 6px;padding:4px 10px;background-color:#dedede">
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888">Name 1:</span> <span style="font-weight:bold">Person 108</span></p>

    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888;padding-right:11px">Name 2:</span>Person 108-A (Type)&nbsp;&nbsp;&bull;&nbsp;&nbsp;Description</p>
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888;padding-right:9px">Date:</span> March 2, 2012 at 11:12pm</p>
</div>
<div style="color:#333;text-align:left;padding-left:4px;margin:0;padding-right:10px;font-size:0.875em;line-height:1.375em;margin-top:10px">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer a magna et massa ultrices porta ut a sem. Nulla eu mauris eget nunc sagittis ornare. Mauris convallis posuere nisi, non posuere turpis mattis ut. Quisque venenatis, dolor ac placerat posuere, velit purus adipiscing libero, eu suscipit nibh justo non nunc. Praesent non odio in nunc tempus volutpat sed ac metus. Nam eleifend adipiscing ipsum, ultricies adipiscing purus accumsan eu. Nulla tincidunt tincidunt varius. Sed non aliquet nunc. Mauris in pulvinar eros. Ut elementum pulvinar interdum. Fusce pulvinar posuere sollicitudin. Nam ultricies auctor sapien, quis eleifend ipsum pharetra hendrerit.</div><!--start form 1-->
<div style="margin-top:36px;display:block"><input class="textInput" id="es_user_2012_0108_1" type="text" value="0" style="float:left;margin:0 2px 0 2px;padding:0;width:60px;height:60px;border:1px solid #999;color:#777;text-align:center;font-size:3.5em;" /><textarea class="noteInput" onFocus="$(this).val('')" id="en_user_2012_0108_1" style="float:left;margin:0 2px 0 2px;padding:2px;width:424px;height:56px;border:1px solid #999;color:#369;text-align:left;font-size:0.75em;">In box to left, enter 1-5 (1=low &amp; 5=high). Use this box for optional notes.</textarea></div>
<!--end form 1-->

<div style="clear:both;"></div></div> <!-- end 0108-1 -->
<div id="n0108-2" style="display:none;width:600px;">
<h1 style="float:left;margin:6px 0 8px 6px;padding:0;border:none;">Header 1</h1>
<h2 style="float:right;margin:9px 8px; 8px 0;padding:0;border:none;">Header 2</h2>
<div style="clear:both;margin:0 6px;padding:4px 10px;background-color:#dedede">
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888">Name 1:</span> <span style="font-weight:bold">Person 108</span></p>
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888;padding-right:11px">Name 2:</span>Person 108-A (Type)&nbsp;&nbsp;&bull;&nbsp;&nbsp;Description</p>

    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888;padding-right:9px">Date:</span> March 2, 2012 at 11:12pm</p>
</div>
<div style="color:#333;text-align:left;padding-left:4px;margin:0;padding-right:10px;font-size:0.875em;line-height:1.375em;margin-top:10px">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer a magna et massa ultrices porta ut a sem. Nulla eu mauris eget nunc sagittis ornare. Mauris convallis posuere nisi, non posuere turpis mattis ut. Quisque venenatis, dolor ac placerat posuere, velit purus adipiscing libero, eu suscipit nibh justo non nunc. Praesent non odio in nunc tempus volutpat sed ac metus. Nam eleifend adipiscing ipsum, ultricies adipiscing purus accumsan eu. Nulla tincidunt tincidunt varius. Sed non aliquet nunc. Mauris in pulvinar eros. Ut elementum pulvinar interdum. Fusce pulvinar posuere sollicitudin. Nam ultricies auctor sapien, quis eleifend ipsum pharetra hendrerit.</div><!--start form 2-->
<div style="margin-top:36px;display:block"><input class="textInput" id="es_user_2012_0108_2" type="text" value="0" style="float:left;margin:0 2px 0 2px;padding:0;width:60px;height:60px;border:1px solid #999;color:#777;text-align:center;font-size:3.5em;" /><textarea class="noteInput" onFocus="$(this).val('')" id="en_user_2012_0108_2" style="float:left;margin:0 2px 0 2px;padding:2px;width:424px;height:56px;border:1px solid #999;color:#369;text-align:left;font-size:0.75em;">In box to left, enter 1-5 (1=low &amp; 5=high). Use this box for optional notes.</textarea></div>
<!--end form 2-->
<div style="clear:both;"></div></div> <!-- end 0108-2 -->
<div id="n0108-3" style="display:none;width:600px;">
<h1 style="float:left;margin:6px 0 8px 6px;padding:0;border:none;">Header 1</h1>
<h2 style="float:right;margin:9px 8px; 8px 0;padding:0;border:none;">Header 2</h2>

<div style="clear:both;margin:0 6px;padding:4px 10px;background-color:#dedede">
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888">Name 1:</span> <span style="font-weight:bold">Person 108</span></p>
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888;padding-right:11px">Name 2:</span>Person 108-A (Type)&nbsp;&nbsp;&bull;&nbsp;&nbsp;Description</p>
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888;padding-right:9px">Date:</span> March 2, 2012 at 11:12pm</p>

</div>
<div style="color:#333;text-align:left;padding-left:4px;margin:0;padding-right:10px;font-size:0.875em;line-height:1.375em;margin-top:10px">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer a magna et massa ultrices porta ut a sem. Nulla eu mauris eget nunc sagittis ornare. Mauris convallis posuere nisi, non posuere turpis mattis ut. Quisque venenatis, dolor ac placerat posuere, velit purus adipiscing libero, eu suscipit nibh justo non nunc. Praesent non odio in nunc tempus volutpat sed ac metus. Nam eleifend adipiscing ipsum, ultricies adipiscing purus accumsan eu. Nulla tincidunt tincidunt varius. Sed non aliquet nunc. Mauris in pulvinar eros. Ut elementum pulvinar interdum. Fusce pulvinar posuere sollicitudin. Nam ultricies auctor sapien, quis eleifend ipsum pharetra hendrerit.</div><!--start form 3-->
<div style="margin-top:36px;display:block"><input class="textInput" id="es_user_2012_0108_3" type="text" value="0" style="float:left;margin:0 2px 0 2px;padding:0;width:60px;height:60px;border:1px solid #999;color:#777;text-align:center;font-size:3.5em;" /><textarea class="noteInput" onFocus="$(this).val('')" id="en_user_2012_0108_3" style="float:left;margin:0 2px 0 2px;padding:2px;width:424px;height:56px;border:1px solid #999;color:#369;text-align:left;font-size:0.75em;">In box to left, enter 1-5 (1=low &amp; 5=high). Use this box for optional notes.</textarea></div>
<!--end form 3-->
<div style="clear:both;"></div></div> <!-- end 0108-3 -->
<div id="n0108-4" style="display:none;width:600px;">
<h1 style="float:left;margin:6px 0 8px 6px;padding:0;border:none;">Header 1</h1>
<h2 style="float:right;margin:9px 8px; 8px 0;padding:0;border:none;">Header 2</h2>
<div style="clear:both;margin:0 6px;padding:4px 10px;background-color:#dedede">
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888">Name 1:</span> <span style="font-weight:bold">Person 108</span></p>

    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888;padding-right:11px">Name 2:</span>Person 108-A (Type)&nbsp;&nbsp;&bull;&nbsp;&nbsp;Description</p>
    <p style="color:#333;text-align:left;padding:0;margin:0;font-size:0.6875em;line-height:1.25em;"><span style="color:#888;padding-right:9px">Date:</span> March 2, 2012 at 11:12pm</p>
</div>
<div style="color:#333;text-align:left;padding-left:4px;margin:0;padding-right:10px;font-size:0.875em;line-height:1.375em;margin-top:10px">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer a magna et massa ultrices porta ut a sem. Nulla eu mauris eget nunc sagittis ornare. Mauris convallis posuere nisi, non posuere turpis mattis ut. Quisque venenatis, dolor ac placerat posuere, velit purus adipiscing libero, eu suscipit nibh justo non nunc. Praesent non odio in nunc tempus volutpat sed ac metus. Nam eleifend adipiscing ipsum, ultricies adipiscing purus accumsan eu. Nulla tincidunt tincidunt varius. Sed non aliquet nunc. Mauris in pulvinar eros. Ut elementum pulvinar interdum. Fusce pulvinar posuere sollicitudin. Nam ultricies auctor sapien, quis eleifend ipsum pharetra hendrerit.</div><!--start form 4-->
<div style="margin-top:36px;display:block"><input class="textInput" id="es_user_2012_0108_4" type="text" value="0" style="float:left;margin:0 2px 0 2px;padding:0;width:60px;height:60px;border:1px solid #999;color:#777;text-align:center;font-size:3.5em;" /><textarea class="noteInput" onFocus="$(this).val('')" id="en_user_2012_0108_4" style="float:left;margin:0 2px 0 2px;padding:2px;width:424px;height:56px;border:1px solid #999;color:#369;text-align:left;font-size:0.75em;">In box to left, enter 1-5 (1=low &amp; 5=high). Use this box for optional notes.</textarea></div>
<!--end form 4-->

<div style="clear:both;"></div></div> <!-- end 0108-4 -->

</div></form>

1 个答案:

答案 0 :(得分:1)

好的,使用下面的代码,我能够做到我认为你想要做的事情,这是在prettyPhoto显示中的访问元素。我将在稍后提供更详细的答案,如果您有任何问题,请随时留下一些评论。

还要注意,您需要打开控制台才能看到代码“工作”;它输出到console.log()

<script>
jQuery(document).ready(function($){
    var $pps = $("a[rel^=prettyPhoto]"),
        $inputs = $('input.textInput'),
        $textinputscls = $('.textInput'),
        $textinputs = $('input.textInput');

    var ppcallback = function(){
        $textinputs = $('input.textInput');

        console.log($textinputs);
        console.log($textinputs.val());
    };

    $pps.prettyPhoto({
        social_tools: false,
        changepicturecallback: ppcallback
    });

    console.log($pps);
});
</script>

http://jfcoder.com/test/prettyphotoiframe.html