Category Archives: jquery

Update variable when checking checkbox

I have a script with some variables, & I would like to update one of these variables depending on the checkbox being checked or not. The checkbox is unselected by default. What I have now is this:

I would like to update the content of the variable “permission” based on a click event of a checkbox:

Fiddle here.

But how is that possible?

In order to update your object key (sv4) value:

If you already store the permission into your Object track, well, than don’t hesitate to use your object & directly manipulate it & setting a new value to it’s key using =.

Never forget to define internally your variables by setting var.

The $('#accept').is(':checked') uses the jQuery .is() method that returns a boolean (true/false) which than we set using Ternary Operator ( ? : ) to "Y" / "N"

Setting base path dynamically through jquery/javascript?

Is there a way to dynamically alter the content inside the tag?, throught jquery or javascript?

I am not using php or any server side script. I am using backbone.js & hence i have a .html file.

I have come to a situation where i would need to type in base path.


I have searched around & i havent received anywhere.

Probably this is not possible at all, yet just wanted to check it here in stackoverflow.

Using jQuery. Here is jsFiddle I’ve made



Will produce:

Add radio input dynamically to jQuery Mobile fieldset controlgroup

I’ve seen variations on this question yet not my specific case on SO, so here goes.

I’m having trouble adding a new radio input dynamically to an existing control group using jQuery Mobile. It will add, yet the style is not correct & it doesn’t appear to interact with the other inputs correctly.

Here’s my fiddle:

Can anyone see what I’m doing wrong? Or is is a case of regenerating the whole fieldset /controlgroup again? 🙁

Thanks! Code below too…

You need to use name="radio-choice-1" as you have used in above. This solves you behavior problem

Behavior problem solved with below change
Your modified code for dynamically adding radio.

Style problem solved with below change
Just recreate div instead of fieldset

Check Fiddle Demo