pedroroccon
261
5
Vue

Laravel, Vue.js and checkboxes: How to check only one?

Posted 2 months ago by pedroroccon

Hello guys! I'm having trouble with a simple checkbox verification.

Usually I do this in jQuery, using the following code:

$('#target').attr('checked');

Well, but now i'm trying to leave the jQuery and start with Vue, so i'm very novice... I'm using Laravel with NPM packages. So I start my development running the following command to compile my assets:

npm run watch

I know that I can put my code in resource/assets/app.js, but I have a page with just one checkbox, and I just want to check if the checkbox is checked or not, and them show a hidden div, according to the selection.

I can't do that inline .in my .blade page? Where's the best place to do that. I don't want to create an components because it's just 1 element in entire form.

Thanks a lot! :)

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.