I am trying to control certain input fields when they are used. The disabling all other fields is working. The re-enabling is not working for some reason. The entire function is not working all together. Here is the function that is not working:
$(".undo").mousedown(function(){
alert("load");
});
I dont get any errors in my console for this function. I have tried other variations to make sure it's just that specific function with that specific attribute referenced. If i were to run that function as $(document).mousedown... instead of $(".undo"), it will work.
here's my entire script:
<script type="text/javascript">
//This part works
$(document).ready(function() {
$(".FirstGoalButton,.SecondGoalButton,.ThirdGoalButton").hide();
var tclass
$(":input").focusin(function(){
tclass = "." + $(this).attr('class');
var fieldval = $(this).val();
$(".FirstGoal,.SecondGoal,.ThirdGoal").change(function(){
$(tclass+"Button").show();
$(":input").prop('disabled', true);
$(tclass).prop('disabled', false);
});
});
});
$(document).ready(function() {
//output to console works
console.log("this Works");
//This part doesn't work
$(".undo").mousedown(function(){
alert("load");
});
//output to console works as well
console.log("end of function");
});
And here is how the button is shown on the page:
<button class="undo" type="button" disabled="">Undo </button>
----------UPDATE-----
THIS WORKS:
$(document).ready(function() {
$(".FirstGoalButton,.SecondGoalButton,.ThirdGoalButton").hide();
$(":input").click(function(){
tclass = "." + $(this).attr('class');
fieldval = $(this).val();
});
$(".FirstGoal,.SecondGoal,.ThirdGoal").change(function(){
var button = tclass + "Button"
$(button).show();
});
$(".undo").mousedown(function(){
alert("load");
});
});
Once $(":input").prop('disabled',true); is added then it disables the function bellow
noConflict
function? Or just usejQuery
instead of$
? And why do you have twoready
functions on the page? Read here: salesforce.stackexchange.com/questions/7884/…