diff --git a/js/functions.js b/js/functions.js index 3836acadee..4377a1dcda 100644 --- a/js/functions.js +++ b/js/functions.js @@ -2324,7 +2324,7 @@ $(document).ready(function() { $("#sqlqueryresults").html(data.sql_query); $("#result_query .notice").remove(); $("#result_query").prepend((data.message)); - $("#copyTable").find("select[name='target_db'] option[value="+data.db+"]").attr('selected', 'selected'); + $("#copyTable").find("select[name='target_db'] option").filterByValue(data.db).attr('selected', 'selected'); //Refresh navigation frame when the table is coppied if (window.parent && window.parent.frame_navigation) { @@ -3545,6 +3545,18 @@ $(document).ready(function() { }; //end noSelect })(jQuery); +/** + * jQuery plugin to correctly filter input fields by value, needed + * because some nasty values may break selector syntax + */ +(function ($) { + $.fn.filterByValue = function (value) { + return this.filter(function () { + return $(this).val() === value + }); + }; +})(jQuery); + /** * Create default PMA tooltip for the element specified. The default appearance * can be overriden by specifying optional "options" parameter (see qTip options). diff --git a/js/import.js b/js/import.js index 68a3793a97..98e34fafe1 100644 --- a/js/import.js +++ b/js/import.js @@ -31,15 +31,15 @@ function matchFile(fname) { var fname_array = fname.toLowerCase().split("."); var len = fname_array.length; - if(len != 0) { + if (len != 0) { var extension = fname_array[len - 1]; if (extension == "gz" || extension == "bz2" || extension == "zip") { len--; } // Only toggle if the format of the file can be imported - if($("select[name='format'] option[value='" + fname_array[len - 1] + "']").length == 1) { + if($("select[name='format'] option").filterByValue(fname_array[len - 1]).length == 1) { $("#plugins option:selected").removeAttr("selected"); - $("select[name='format'] option[value='" + fname_array[len - 1] + "']").attr('selected', 'selected'); + $("select[name='format'] option").filterByValue(fname_array[len - 1]).attr('selected', 'selected'); changePluginOpts(); } } diff --git a/js/sql.js b/js/sql.js index bfbbf3a256..a7cfe988ea 100644 --- a/js/sql.js +++ b/js/sql.js @@ -411,7 +411,7 @@ $(document).ready(function() { /** * Click action for "Go" button in ajax dialog insertForm -> insertRowTable */ - $("#insertForm .insertRowTable.ajax input[value=Go]").live('click', function(event) { + $("#insertForm .insertRowTable.ajax input[type=submit]").live('click', function(event) { event.preventDefault(); /** * @var the_form object referring to the insert form diff --git a/js/tbl_structure.js b/js/tbl_structure.js index f2788074c0..8bbd8bb493 100644 --- a/js/tbl_structure.js +++ b/js/tbl_structure.js @@ -339,7 +339,7 @@ $(document).ready(function() { /** *Ajax event handler for Add column(s) **/ - $("#addColumns.ajax input[value=Go]").live('click', function(event){ + $("#addColumns.ajax input[type=submit]").live('click', function(event){ event.preventDefault(); /*Remove the hidden dialogs if there are*/