jQuery selector for inputs with square brackets in the name attribute

I’m trying to select this element which has square brackets in the name attribute: <input type=”text” name=”inputName[]” value=”someValue”> I’ve tried this (which doesn’t work): $(‘input[inputName[]=someValue]’) and neither does this: $(‘input[inputName&#91;&#93;=someValue]’) or this: $(‘input[“inputName[]”=someValue]’) EDIT: As some of you have pointed out, $(‘input[inputName=someValue]’) would never work. What I was trying to do was: $(‘input[name=inputName][value=someValue]’). (But with … Read more

Sanitizing comments or escaping comment_text()

I’m creating a template for comments on my WordPress site. I noticed that a simple <script>alert(1);</script> slips through the default WP codex implementation of comments, using the comment_text() function to display my comments. No bueno. How can i properly sanitize and/or escape WordPress comments? The esc_html() function, seems to do nothing in this case. 1 … Read more

Find all unchecked checkboxes in jQuery

I have a list of checkboxes: <input type=”checkbox” name=”answer” id=”id_1′ value=”1″ /> <input type=”checkbox” name=”answer” id=”id_2′ value=”2″ /> … <input type=”checkbox” name=”answer” id=”id_n’ value=”n” /> I can collect all the values of checked checkboxes; my question is how can get all the values of unchecked checkboxes? I tried: $(“input:unchecked”).val(); to get an unchecked checkbox’s value, … Read more