live() method does not work if selector has dot character
I am trying to work live method work but could not if id/name has . (dot) character.
jQuery1.4.2
Example:
<html>
<head>
<script type="text/javascript" src="../scripts/jquery-1.4.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('[id="state._[0]"]').live('change blur',function(){
alert("event triggered");
});
});
</script>
</head>
<body>
<form>
<input type="text" size="10" id="state._[0]"/><br/>
<input type="text" size="10" id="test"/>
</form>
</body>
</html>
If id has '.' character then live event did not trigger. If I use two escape characters in selector like id=state\\._\\[0\\] it still not work. I dig into jQuery and looks like (not completely sure) closest method did not return matched element.
If I use bind method (instead of live) it worked fine without changing any other code.
Thanks for any help,
Pratik