I’m getting crazy already:
I have exactly this same code on my application:
http://jsfiddle.net/MZbLW/144/
EXACTLY THE SAME.
However, on my application the SECOND alert box NEVER shows.
Here’s the copy paste:
<script>
if (typeof jQuery != 'undefined') {
alert("jQuery library is loaded!");
}else{
alert("jQuery library is not found!");
} // yes I'm this desperate!
$(document).ready(function() {
// Using on method
$(".trigger").on("click", function()
{
// Using length instead of size. Using === instead of ==
if($('#localized fieldset').length === 1)
{
window.alert("PLEASE SHOW "); //THIS DOESN'T APPEAR;
}
else
{
$('#localized fieldset:last-child').remove();
// Toggle visibility.
$(".trigger").toggle();
}
//return false; //prevent default anchor action;
});
});
</script>
<style>
.linkRemove {
display:none;}
</style>
<div id="localized">
<fieldset>
<label>hello</label>
<input type="text" />
</fieldset>
</div>
<a class="trigger" href="#"> Add Translation ▼</a>
<a class="trigger linkRemove" href="#"> Remove Translation</a>
I’m aware that without accessing the application code itself, it’s not easy to debug, but, a simple “What could it be” may help me figuring this out.
Please advice.
Issue solved.
It was related with the fact that the Application was running a different Jquery version of that on Jsfiddle.
The method “on” was not suported, hence, the fact we were getting different outputs with the same code.