Reputation: 190
I have a table that in each row there is a checkbox and at the bottom of the table there is a input box that we can enter color name in it (example : fff). and when we click on submit change color of all 'tr' that checked check boxes to the color that we entered in inputbox
Upvotes: 0
Views: 86
Reputation: 134
I created a simple example of what I think you want to do. Hopefully it should get you started. Check it out on jsfiddel, http://jsfiddle.net/YGWKA/
Upvotes: 0
Reputation: 78520
You mean like this?
$("#btn").click(function(){
$("input:checked").parents("tr").css({background:"#" + $("#color").val()});
});
Upvotes: 0
Reputation: 16115
It would be easier if we could see your html.
$('form').submit(function() {
var sColor = '#' + $('input[type="text"]').val();
$('input:checked').closest('tr').css('background-color', sColor);
return false;
});
Upvotes: 2