Category: javascript jquery

  • jQuery – Avoid duplicate element’s IDs

    If the input element has an ID and it is duplicate with another element, it’s likely cause an error. In this case, Firefox 3.5 and IE8 on Windows Vista has no problem while same browsers in Windows XP does not work. Problem … … … $(“#myform #action”).val(); That works in Vista and Mac OSX but…

  • jQuery odd/even selector bug?

    For some reason I have not been able to identify and test, this code would not work (show the same color or same color for subsequent rows, does not seem to have a pattern): $(“#tableid tbody tr:even”).addClass(“even”); $(“#tableid tbody tr:odd”).addClass(“odd”); But this does work: $(“#tableid tbody tr:nth-child(even)”).addClass(“even”); $(“#tableid tbody tr:nth-child(odd)”).addClass(“odd”); Any thought?