Set checkbox to "checked" without using angularjs

Dear all,
I am implementing an application using the ionic framework without using angularjs and the other functionalities. Actually I only want to use the ionic styles (css parts), which are really nice :heart_eyes:
In my application I have a list of checkboxes and now I want to make some checkboxes set to “checked”.
I’ve tried it using jquery-functionalities, but this does not work:
$( "#sport").prop('checked', true), where “#sport” is the id of the checkbox.

Is there any way to do so?
Thanks in advance!

I doubt you will succeed, the Ionic styles are working hand in hand with Ionic angular directives.

While I recommend using AngularJS with Ionic to take full advantage of Ionic’s capabilities, this is possible using the code you mentioned. Here is a Codepen example (note that jQuery is being included on the JS tab):

1 Like

Why wouldn’t he be able to use the CSS? It’s CSS. It doesn’t require Angular to function.

It depends on what he wants to use, I don’t think he could use anything about navigation like tabs for instance.

I was not speaking about the checkbox particular problem but rather about the application itself.

Maybe not the directive itself, but he could use the styles of the tabs and re-implement the login quite easily with JavaScript.

@brandyshea Tanks…works like a charm :blush:
@andrewmcgivery You’re right. For the app itself, I am planning to use some other ionic-styles. Because my app is very basic (and I have absolutely no skills in angular), I’ll implement some function on my own…the UI won’t be too complex, so this is hopefully possible without any problems.

Thanks for your support!