input
How do I setup nested repeatable option fields?
I’m trying to wrap my head around how to create a set of option fields that should be able to repeat for as many times as possible. But I’m having a hard time to figure out how to proceed. Currently I’ve setup the visual interface for administering the options, but I have no idea how … Read more
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[]=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
How to delete a specific line in a file?
Let’s say I have a text file full of nicknames. How can I delete a specific nickname from this file, using Python? 17 Answers 17
Get data from dropdown and update page
I have a simple webpage with a dropdown menu with a few options. I would like to be able to get the user’s selection and then output the same selection on the webpage. This is the code I have so far. \\Pretty standard code for getting the header and title and <\div> etc. <select id=”animal” … Read more
How do I implement onchange of with jQuery?
<select> has this API. What about <input>? 14 Answers 14
Do checkbox inputs only post data if they’re checked?
Is it standard behaviour for browsers to only send the checkbox input value data if it is checked upon form submission? And if no value data is supplied, is the default value always “on”? Assuming the above is correct, is this consistent behaviour across all browsers? 12 Answers 12
Set keyboard caret position in html textbox
Does anybody know how to move the keyboard caret in a textbox to a particular position? For example, if a text-box (e.g. input element, not text-area) has 50 characters in it and I want to position the caret before character 20, how would I go about it? This is in differentiation from this question: jQuery … 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