I’m not very experienced when it comes to any kind of web development, much less jquery and ajax, which I am required to use so I’m having a dificult time.
I’m working on a project that requires me to repaint two checkboxes to ‘unchecked’ when a seperate button called “Reopen” is clicked. Right now the code I’m working with is:
$('.reopenBtn').click(function() {
var confirm_reopen = confirm("Are you sure you want to open this opportunity back up?");
if (confirm_reopen) {
var href = 'cfcs/opportunity.cfc';
var method = 'ReopenOp';
var opsid = $(this).parent().parent().attr('id');
$('#' + opsid).ajaxSuccess(function() {});
$.post(href, {
method: method,
opsid: opsid
});
$('.lost').removeAttr('checked');
$('.won').removeAttr('checked');
}
});
The problem with this code is that it repaints all instances of the checkboxes on the page and not just the specific instance of the won and lost check boxes. What I’m looking for is something like this:
$(this).('.lost').removeAttr('checked');
$(this).('.won').removeAttr('checcked');
Like I said, I’m not very experienced with most web development languages so I really dont know the syntax to be able to do this. My limit is just being able to read and understand the code enough to tweak and change it, not start from scratch on anything new.
Any help would be greatly appreciated!
You can pass this as the context in your selector http://api.jquery.com/jQuery/#selector-context
Just FYI though, .prop() is the right way to set disabled in property as of jQuery 1.6+