Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery is not allowing line breaks in text areas
    text
    copied!<p>I'm having a weird issue. When adding support for Jquery 1.7.2, I am unable to add line-breaks to textareas in forms. When I click, enter, nothing happens.</p> <p>I fiddled with the source code in jquery, and found that if I commented out the following code (on line 4845)</p> <pre><code>for ( var type in Expr.match ) { Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); } </code></pre> <p>the ability to add line breaks was restored. I'm not seeing anyone else having this issue, so I'm guessing something else is going on. However, my question is: what is the purpose of the code above (I'm not very javascript-savvy), and does removing it pose any risk? I'd like to just remove the code and restore line break ability to textareas, but don't want to bork the site unknowingly. I did notice that after doing this, I'm seeing an error in the js console:</p> <pre><code>Uncaught TypeError: Cannot call method 'exec' of undefined -- jquery.js:4185 </code></pre> <p>Any help would be greatly appreciated!</p> <hr> <p>Here is some code sample. The html:</p> <pre><code> &lt;form class="form-input" method="post"&gt; &lt;fieldset&gt; &lt;ol&gt; &lt;li&gt; &lt;label for="activity_type_id"&gt;Activity Type&amp;nbsp;&lt;em&gt;*&lt;/em&gt;&lt;/label&gt; &lt;select name="activity_type_id"&gt;&lt;option value="17" label="Call"&gt;Call&lt;/option&gt;&lt;option value="23" label="Connectivity Meeting"&gt;Connectivity Meeting&lt;/option&gt;&lt;option value="22" label="Conversation"&gt;Conversation&lt;/option&gt;&lt;option value="16" label="Email (incoming)"&gt;Email (incoming)&lt;/option&gt;&lt;option value="15" label="Email (outgoing)"&gt;Email (outgoing)&lt;/option&gt;&lt;option value="19" label="Implementation Notes"&gt;Implementation Notes&lt;/option&gt;&lt;option value="20" label="Meeting Minutes"&gt;Meeting Minutes&lt;/option&gt;&lt;option value="18" label="Task"&gt;Task&lt;/option&gt;&lt;option value="21" label="Tip / Unusual Attribute"&gt;Tip / Unusual Attribute&lt;/option&gt;&lt;/select&gt; &lt;/li&gt; &lt;li&gt; &lt;label for="summary"&gt;Summary&amp;nbsp;&lt;em&gt;*&lt;/em&gt;&lt;/label&gt; &lt;input size="40" maxlength="80" id="summary" name="summary" value=""/&gt; &lt;/li&gt; &lt;li&gt; &lt;label for="details"&gt;Details&amp;nbsp;&lt;/label&gt; &lt;textarea class="wide" name="details" id="details" rows="10" columns="80"&gt;&lt;/textarea&gt; &lt;/li&gt; &lt;/ol&gt; &lt;/fieldset&gt; &lt;input id="submit" name="addactivity" value="Add Activity" type="submit" /&gt; &lt;/form&gt; </code></pre> <p>And the javascript that isn't included with other plugins:</p> <pre><code>&lt;script&gt; // Dynamic lookup of C2 companies $(document).ready(function () { $(window).keydown(function(event) { if(event.keyCode == 13) { event.preventDefault(); return false; } }); $("#search_input").autocomplete( { source: function(request,response) { $("#loading-search").show(); $("#no-results").hide(); $.getJSON("/services/json/cust_search.php",request,function(data) { response(data); $("#loading-search").hide(); if (data.length == 0) { $("#no-results").show(); } else { $("#no-results").hide(); } }); }, minLength: 3, select: function(event,ui) { $("#search_input").hide(); $("#search_input").val(ui.item.value); $("#search_source").val(ui.item.source); $("#search-form").submit(); } }); }); &lt;/script&gt; &lt;script type="text/javascript"&gt; //--------------------------------------------------------------------------- // Hide all the submenus on start. When a non-expanded menu is clicked, // expand that menu while collapsing the menu above it. If a menu is // clicked when its expanded, collapse. //--------------------------------------------------------------------------- $(function() { // $("dd:not(:first)").hide(); $("dd").hide(); $("#menu-nexmark").slideDown("fast"); $("dt a").click(function() { var curr_dd = $(this).parent().next(); if (curr_dd.css("display") != "none") { $("dd:visible").slideUp("medium"); return; } $("dd:visible").slideUp("slow"); curr_dd.slideDown("slow"); return false; }); }); &lt;/script&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload