$(".classname").click(); not working on IE nor Chrome
Hello,
I need a webpage with a lot of input:text and select:option.
each modification on an element must be immediately validated through ajax.
for this reason, the best choice i've found is to add a form element around each box.
and use the classname of the input:submit button to identify the form instead of the ID of the form.
the submit button is hidden so the default choice to validate the form is to press enter after modification in the cell.
however, as it works perfectly in FF and Opera, nothing happens on IE and Chrome.
here is an extract of the code :
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="fr-FR">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" language="javascript" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8">
<!--
$(document).ready(function() {
jQuery(".submit").click(function() {
var element = $(this);
var ID = '4'; // index value populated by php
// ID from the input:submit
var sqlobj = element.attr("id");
// each ID from input:text is "add"+ID from input:submit
// on récupère sa valeur
var sqlval = $( "#add"+ sqlobj ).val();
// url construction
var dataString = 'id='+ ID +'&'+ sqlobj +'='+ sqlval;
alert( dataString );
return false;
});
});
-->
</script>
</head>
<body>
<form id="mandays" method="post" action="">
<table border="0" cellpadding="0" cellspacing="0" id="tablemandays">
<tr><th>M</th><th>I</th></tr>
<tr>
<td>
<form method="post" action="">
<input type="text" id="addSDM" value="5"/>
<input type="submit" class="mandays submit" id="SDM" style="height:0px;width:0px;"/>
</form>
</td>
<td>
<form method="post" action="">
<input type="text" id="addACI" value="4"/>
<input type="submit" class="mandays submit" id="ACI" style="height:0px;width:0px;"/>
</form>
</td>
</tr>
</table>
</form>
<a href="/test.php">refresh</a>
</body>
</html>
please help me to understand my mistakes :/