Not sure if this'll do anything, but you should prolly use if(body === "") instead of if(body == "") because "comparisons against null, 0, true, false, or an empty string allowing implicit type conversion".
vincehofmeister wrote: > > > Ok, So my code is running fine under FF2, no problems. However, IE7 is > a different story. The only thing that seems to be working under IE7 > in all of my jQuery code is this... > > > > Now... all of this following code works under FF2 PERFECTLY... and I > feel like its something simple I am doing wrong under IE7 with this > code: > > > $(document).ready(function() { > > $("form#add_comment").submit(function(){ > > //function for ajax comment system > var body = $("#body").val(); > var maxCharacters = 500; > if(body == "") > { > //if the comment body is empty, do nothing > $("#comment_error").html("Oops, please enter a > comment..."); > $("#comment_error").show("medium"); > return false; > } > else if(body.length > maxCharacters) > { > $("#comment_error").html("Whoops, a comment can only be > 500 > characters long!"); > $("#comment_error").show("medium"); > return false; > } > else > { > //send an ajax post request to the server > $.post("/nzbs/add_comment", { > 'data[Comment][body]' : $("#body").val(), > 'data[Comment][nzb_id]' : $("#nzb_id").val(), > }, function(data) > { > //callback function after post request > $("div.add_comment_container").hide(); > $("p.empty").hide(); > $("div.comments").append(data); > } > ); > return false; > } > }); > > //controls the image to be shown during ajax request > $("div#show_on_ajax").ajaxStart(function(){ > $(this).show(); > }); > //controls the image to be hidden after the ajax request is > complete > $("div#show_on_ajax").ajaxStop(function(){ > $(this).hide(); > }); > > > //hides the download link after it is finished completing > $("a#download_link").click(function(){ > $(this).hide(); > $("td#download_td").html("Downloading file..."); > > }); > > > > > > > > > > > > }); > > > > > //function that controls viewing more comments > function comment_request(nzb_id){ > > $.get("/nzbs/view_more_comments/"+nzb_id, > function(data){ > $("a#view_rest_link").hide(); > $("div.comments").append(data); > }); > > } > > //function that determines how many characters are left when posting a > comment > function characterCount(){ > > var body = $("#body").val(); > var maxCharacter = 500; > var charactersLeft = 500 - body.length; > > if(charactersLeft <= 0) > { > var charactersLeft = "0"; > } > > $("span.character_count").html(charactersLeft); > } > > > > function checkAll(){ > $("input.check_change").attr("checked", "on"); > } > > function uncheckAll(){ > $("input.check_change").removeAttr("checked", "on"); > } > > > > > Now, I attempted to use Firebug Lite under IE7 to help diagnose the > problem, but the page would throw an error saying the page cannot be > loaded and IE must close. So in the status bar after loading the page > without Firebug Lite it says error on page and here is the information > it gives... > > Line: 28 > Char 3 > Error: Unexpected Identifier, string, or number > Code: 0 > > > > I have also gotten IE to throw some sort of error about an unexpected > object or something. > > It is also important to note that under FF2 and using firebug 0 errors > show up. I think my code is fine... is something wrong with IE7 that > would render all of this code useless? > > Thanks for any advice. > > -- View this message in context: http://www.nabble.com/Trouble-with-attr%28%29-and-IE7%2C-and-onclick...-tp16786990s27240p16803965.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.