jquery-1.9

how to use .toggle with jquery 1.9

假装没事ソ 提交于 2019-11-28 00:34:50
i'm trying to use the toggle method with jquery 1.9 but it's been removed and here's a simple example to toggle div content http://jsfiddle.net/Y5pFe/1/ code : <div class="divone"></div> $(document).ready(function(e) { $('.divone').toggle(function() { $(this).text("click one"); }, function() { $(this).text("click two"); }); }); what's the alternative method please ? I would just use .click and assign an attribute as a flag: <div class="divone"></div> $(document).ready(function(e) { $('.divone').click(function() { if($(this).hasClass("clicked")) { $(this).text("removing click"); $(this)

Syntax error with parseJSON during unobtrusive validation

孤街浪徒 提交于 2019-11-27 20:37:35
My MVC app is generating the following HTML which causes a Javascript syntax error upon submission (I'm not typing anything into the two text boxes). Here's the generated HTML and the submit handler: <form action="/UrIntake/Save" id="UrIntakeForm" method="post"> <input data-val="true" data-val-length="The field LastName must be a string with a maximum length of 50." data-val-length-max="50" data-val-required="The LastName field is required." id="FormSubmitter_LastName" name="FormSubmitter.LastName" type="text" value="" /> <input data-val="true" data-val-length="The field FirstName must be a

how to use .toggle with jquery 1.9

别说谁变了你拦得住时间么 提交于 2019-11-26 21:44:19
问题 i'm trying to use the toggle method with jquery 1.9 but it's been removed and here's a simple example to toggle div content http://jsfiddle.net/Y5pFe/1/ code : <div class="divone"></div> $(document).ready(function(e) { $('.divone').toggle(function() { $(this).text("click one"); }, function() { $(this).text("click two"); }); }); what's the alternative method please ? 回答1: I would just use .click and assign an attribute as a flag: <div class="divone"></div> $(document).ready(function(e) { $('