HTML Function Edit

The function I have only responded to a button click but not the image click. Can anyone tell me what would I need to modify in the function so that it responds to both button & image clicks?

function clickMe(a,b) {
    $("#q"+b+" input[type='button']").click(function(event) {
        if(event.preventDefault) event.preventDefault();
        else event.returnValue = false;
        if(b !== $(".qc").length) {
            $("h1").html(a);
            $("#q"+b).hide(250, function() {
                $("#q"+b).next().fadeIn(250);
            });
        } else {
            $("h1").html(a);
            $("#q"+b).hide(250, function() {
                $("#q"+b).next().fadeIn(250, function() {
                    loading(0);
                });
            });
        }
    });
}

Open in new window

James RossAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David S.Commented:
It might be as simple as changing the selector, but you haven't provided sufficient information for us to be certain. The jQuery function allows passing a second argument as context, so you can select descendants with different selectors.
$("input[type='button'], img","#q"+b)

Open in new window

2

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
David S.Commented:
There has been no activity for over 2 weeks. so we'll accept the 1 response as the solution.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.