views:

43

answers:

4

I'm trying to change a checkbox value from chrome JavaScript console. I'm aware that changes are printed to object and not on screen. I'd like to execute a jQuery statement, i.e.:

('input[name=foo]').attr('checked', true);

Is there any way to enter a jQuery statement, and and see changes instantly in the page?

+2  A: 

you mean like this?

alt text

How are you doing it? works fine in Safari and Chrome.


If you want to know about using Debugging Tools in the browsers, I would strongly suggest to look at Remy Sharp Tutorial on jQuery for Designers entitled Debugging Tools.

balexandre
A: 
$('input[name=foo]').click();

does the same thing as clicking with your mouse.

sje397
A: 

You can do in chrome console whatever you can do in javascript, so if page has jqyery loaded, you can access the element and check/uncheck it e.g. stackoverflow.com (this site) uses jquery so I can just access answer textarea and enter a value, try this

$('#wmd-input').val('This is my answer') 

So you can do anything which is possible in jquery.

Anurag Uniyal
A: 

If you got jQuery loaded in the current page, you can type jQuery command.

Just type $('input[name=foo]').attr('checked', true); or whatever should work in jQuery and press enter.

Chouchenos