You can pass an anonymous callback function as the click handler which will call the method a
with desired parameters
$(this).click(function(){
a(this)
});
Question
<script type='text/javascript'>
$(window).load(function() {
$(document).ready(function() {
$('table tr').each(function() {
if ($(this).find('td').eq(6).text() === 'Start') {
$(this).css('background', 'yellow');
$(this).addClass('Start_Point');
$(this).click(a);
}
});
});
});
function a()
{
alert();
}
</script>
I want send this object to my method using .click ..
I am already do following bt its not work . the method a() is calling when the function match case for 'start' which is wrong i want when user click on table the function a() will call
<script type='text/javascript'>
$(window).load(function() {
$(document).ready(function() {
$('table tr').each(function() {
if ($(this).find('td').eq(6).text() === 'Start') {
$(this).css('background', 'yellow');
$(this).addClass('Start_Point');
$(this).click(a(this));//This
}
});
});
});
function a()
{
alert();
}
</script>
Solution
You can pass an anonymous callback function as the click handler which will call the method a
with desired parameters
$(this).click(function(){
a(this)
});
OTHER TIPS
try this
$(function(){
$(this).click(function(){
a(this)
});
})
then u can try
$('.Start_Point').click(function(){
a(this)
});