w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
JavsScript. Select all invisible elements. (WebKit only)
If you are using jQuery for selecting elements, below code would fulfill your requirement var allHiddenElements = $("body *").filter( function() { return $(this).css("display") == "none"; });

Categories : Javascript

Define CSS style for single input ID, instead of input[type=checkbox]
input#A1 input#A2 input#A1:checked input#A2:checked But you don't need to specify the tag name (input) if you don't want. But it can be useful though! (Especially with classes) Read more about (ID-)selectors in the docs.

Categories : CSS

CSS input checkbox when input is already defined
You need to apply the style from the id #msform to overwrite completely the previous declaration. #msform input[type=checkbox] { width: 13px; height: 13px; padding: 0; margin:0; vertical-align: middle; position: relative; top: 26px; right: 60px; overflow: hidden; } Try playing with it now.

Categories : Jquery

Passing Checkbox values to model
Actually, you can't do a many-to-many relationship that way... you need to do has_many :through or alternatively has_and_belongs_to_many Nice explanation here... http://guides.rubyonrails.org/association_basics.html

Categories : Ruby On Rails

passing two values for same checkbox field in get form
Use different names for each checkbox, (don't use name="type" for each one) <form> <input type="submit" id="searchsubmit" value="Sort Projects" class="project-sort" /> <input type="checkbox" name="type1" class="type-checkbox" value="type1"> <label for="type1">Type 1</label> <input type="checkbox" name="type2" class="type-checkbox" value="type2"> <label for="type2">Type 2</label> <input type="checkbox" name="type3" class="type-checkbox" value="type3"> <label for="type3">Type 3</label> </form> Matching names are for groups of radio buttons, not checkboxes. Generally speaking, matching names are for groups of radio buttons, not checkboxes. There are some reasons to use matching names (mentioned below)

Categories : PHP

How to turn a hidden type input into a checkbox type input?
Give all inputs the class input_skill, like this: echo '<div class="skillName"><input type="hidden" name="skill[]" value="' . $userSkills[$x] . '" title="Click to select" class="input_skill">' . $userSkills[$x] . "</div>"; Then use this function to change their types: <script type="text/javascript"> function ShowSkillCheckboxes() { var skills = document.getElementsByClassName("input_skill"); for(var i=0; i<skills.length; i++) skills[i].setAttribute("type","checkbox"); } </script> Keep in mind that the special checked value which the elements get by becoming checkboxes will vanish once you transform the checkboxes back into hidden type inputs. Besides: hidden inputs do not display at all on the webpage. You can say they have 0x0 px dime

Categories : Javascript

Assign ViewBag value to input checkbox?
I recommend using this, assuming you are using Razor: @Html.CheckBox("chkSolicitation", (bool)ViewBag.Solicitation) If you are not using Razor, use this: <%: Html.CheckBox("chkSolicitation", (bool)ViewData["Solicitation"]) %>

Categories : Asp Net Mvc

How to change the name of input checkbox with jQuery?
If you want to name your inputs using their id, then you can do $('input[name="INPUT_NAME"]').attr('name', function(){ return 'INPUT_NAME['+ this.id +']' }); But really, there is no good reason I can imagine to do such a thing.

Categories : Jquery

Toggle text, on a checkbox input change
Try var $contriesp = $('.countries > p'); $('.chbxs input[type="checkbox"]').click(function(){ var $chk = $(this), rel = $chk.attr('rel'); if (this.checked) { $('<span />', { html: $chk.next('label').text() }).appendTo($contriesp).attr('rel', rel) } else { $contriesp.children('span[rel="' + rel + '"]').remove(); } }); Demo: Fiddle

Categories : Jquery

Input control type Checkbox always true
You should be using input type radio, not checkbox, for two mutually exclusive selections: <input runat="server" type="radio" name="chkChildSex" value="male" id="chkChildSexMale" /> <input runat="server" type="radio" name="chkChildSex" value="female" id="chkChildSexFemale" /> When you use the same name attribute for two checkboxes, the second overrides the first. When you use the same name attribute for two radio buttons, it associates them and the value is the value of the checked item.

Categories : C#

Jquery input checkbox & radio - not working
Always check the javascript console of your browser. It is your friend. In your example I see an error telling me Uncaught Error: Syntax error, unrecognized expression: [name=option[218]] that is caused by this expression $('input[name='+input.attr('name')+']') If the name value is different from a simple name (in your case it is option[218]) then you have to use extra quotes around the value. So change your code to $('input[name="'+input.attr('name')+'"]') and the error is gone.

Categories : Jquery

Change text immediately following a checkbox input
change: <input type="checkbox" name="email" /> Email to: <input type="checkbox" name="email" /> <span>Email</span> and your code is: $('input[name=email]').prop('checked',true).next('span').html('Email (enabled)');

Categories : Jquery

jquery to display value of row input and checkbox status
Fiddle You must find checkbox in current row, not in whole table. if (row.find('input[name^="treated"]').is(':checked')) {

Categories : Jquery

sort input/checkbox elements alphabetically
if you can wrap them in label, which is a good practice to do anyways, you can do this: Html <form id="stuff"> <label> <input type="checkbox" value="bbb" />bbb</label> <label> <input type="checkbox" value="aaa" />aaa</label> <label> <input type="checkbox" value="ccc" />ccc</label> </form> Script var sortByText = function (a, b) { return $.trim($(a).text()) > $.trim($(b).text()); } $(document).ready(function () { var sorted = $('#stuff label').sort(sortByText); $('#stuff').append(sorted); }); Demo

Categories : Javascript

selecting text next to an checked input checkbox using JQuery (or JS)?
You can use: <input ... onclick="alert(this.nextSibling.data);"> Of course that is very dependent on the structure of the DOM. You may want to concatenate the data in all the text nodes from this element to the next, so you might need a function like: function getTextByNodes(el) { var text =''; while (el && el.nextSibling && el.nextSibling.nodeType == 3) { text += el.nextSibling.data; el = el.nextSibling; } return text; } with: <input ... onclick="alert(getTextByNodes(this));">

Categories : Javascript

Grails rendering plugin (pdf ) does not render Checkbox input
Rendering plugin does not render image using img tag. You have to use rendering plugin's tags to render the image. <rendering:inlinePng bytes="${imageBytes}" class="some-class" /> and many more. Please have a look in the link. Grails Rendering Plugin - Reference Documentation

Categories : Grails

Bootstrap checkbox/radio buttons do not change value
It looks like you are missing a call to "activate" the btn-group (documentation). Here is a demo of this working: <form id='testForm'> <div class="btn-group" data-toggle="buttons"> <label class="btn btn-primary"> <input type="checkbox" name='Option' value='1' />Option 1</label> </div> </form> <button class='btn' id='actionSubmit'>Submit</button> <script> $('#actionSubmit').on('click', function (e) { e.preventDefault(); alert($('#testForm').serialize()); }); $('.btn-group').button(); </script>

Categories : Javascript

Populate input field based on checkbox id values
$('#checkbox') looks for an element with id="checkbox", like this <input type="text" id="checkbox" /> but you don't have any in your html, so nothing happens. If you have checkbox elements like <input type="checkbox" />, then you can select the checkboxes like this: $(':checkbox') and you can select the "checked" boxes like this: $(':checkbox:checked')

Categories : Javascript

validating input types "checkbox" and "number" php/html
Three words: array it up! Observe this code: <form action="order.php" method="post"> <p> Coffee: <br> <!-- This ensures false is submitted if the cappuccino box is unticked --> <input type="hidden" name="coffee[cappuccino][selected]" value="0"> <label><input type="checkbox" name="coffee[cappuccino][selected]" value="1"> Cappuccino</label> <input type="number" name="coffee[cappuccino][qty]" size="2"><br> <!-- This ensures false is submitted if the espresso box is unticked --> <input type="hidden" name="coffee[espresso][selected]" value="0"> <label><input type="checkbox" name="coffee[espresso][selected]" value="1"> Espresso</label>

Categories : PHP

php / jquery progress bar working with input change (checkbox: check)
I've found a solution this morning myself, a little changes have been made as follows, rest external sources will remain same. Whole Code: <div id="progressbar"></div> 25% <input type="checkbox" name="c1" id="c1" onChange="update();" /> &nbsp; 50% <input type="checkbox" name="c2" id="c2" onChange="update();" /> &nbsp; 75% <input type="checkbox" name="c3" id="c3" onChange="update();" /> &nbsp; 100% <input type="checkbox" name="c4" id="c4" onChange="update();" /> Whole Script: var x=0; /* Just display progress bar at 1st*/ $(function() { $( "#progressbar" ).progressbar({ value: x }); }); function update(){ // For 25% increase var c1 = $('input[name="c1"]:checked').length > 0; if(c1){ $( "#prog

Categories : Javascript

input type checkbox not working inside bootstrap modal
Guess you try to overcome bootstrap modals e.preventDefault() in click events - this is why it never works. Also the two events seems to obsulete each other? Try this instead : $('.checkInp input:checkbox').on('click', function(e) { // prevents the event from bubbling up the DOM tree // eg the modal from cancelling the event e.stopImmediatePropagation(); var checked = (e.currentTarget.checked) ? false : true; e.currentTarget.checked=(checked) ? false : checked.toString(); }); forked fiddle : http://jsfiddle.net/AurPX/

Categories : Javascript

How to enable multiple input text fields with one checkbox with jquery?
$('#checkbox').click(function() { $(".inputbox").prop("disabled",false); }); "inputbox" is make it as class. DEMO

Categories : Jquery

How to input multiple checkbox values into a hidden textbox via javascript
If you can use jQuery, you won't need much code: You could update the results whenever somebody clicks on a checkbox ($('input').on('click', function() {). I personally would use <label> elements, but that's just me. You could grab the values by $('input:checked').each(function() { values.push($(this).parent().text()); }); Here is a working example: http://jsfiddle.net/HarryPehkonen/zNfju/1/

Categories : Javascript

jQuery Mobile Input checkbox displays double in IE10
Check your code that populate checkbox. JQM's checkbox has this input on top of lable. Like this... <div class="ui-checkbox"> <input type="checkbox" name="checkbox-2a" id="checkbox-2a"> <label for="checkbox-2a" data-corners="true" data-shadow="false" data-iconshadow="true" data-wrapperels="span" data-icon="checkbox-on" data-theme="c" data-mini="false" class="ui-checkbox-on ui-btn ui-btn-hover-c ui-btn-corner-all ui-fullsize ui-btn-icon-left ui-btn-up-c"> <span class="ui-btn-inner"> <span class="ui-btn-text">Doritos</span> <span class="ui-icon ui-icon-checkbox-on ui-icon-shadow">&nbsp;</span> </span> </label> </div>

Categories : Jquery

How to echo multiple rows with data based on checkbox input?
May be this will work : $w = "'".implode("','",$_POST['pal_num'])."'"; $rrr = mysql_query("SELECT * FROM pl_tab WHERE pal_num in (".$w.");"); ...and may be you forgot a echo "<table>"; before the while :)

Categories : PHP

Ng-model's attribute in a ng-repeat input checkbox gets always literal or give error
In AngularJS 1.1.5 there is "track by" that you can use in ngRepeat. So you can: <input type="checkbox" ng-repeat="e in extra track by $index" ng-model="extra[$index]"> Here is a example: http://plnkr.co/edit/6lNo6R5EPsNGHUU6ufTE?p=preview

Categories : Angularjs

Set checked attribute of checkbox in Jade template based on input from Node
I did something like this few days ago. What I did is assign a boolean value to the 'checked' attribute. See code below. Note that I changed your check variable from string to boolean. I also removed the if-then-else statement. - categories.forEach(function(category) { - var check = false - article.categories.forEach(function(id) { - if(id === category._id) { - check = true - } - }); li: label.checkbox input(type="checkbox", name="categories", checked=check, value=category._id) =category.name - });

Categories : Node Js

jquery - cant correctly pass checkbox object to function when 'changing' another input
var cb = $(this).siblings('input[name^="treated"]'); supposed to be var cb = $(this).closest('tr').find('input[name^="treated"]'); The siblings will not work in this case as input[name^=treated] is not a sibling of the quantity input. Siblings are the elements are are present at the same level as the other elements. But here the treated input in inside another td and not the same td Check Fiddle

Categories : Jquery

Passing input value into name of input
Judging by your comment, it seems like you are having trouble passing the input fields to the second snippit of code (via a submit button or javascript). You need to surround the input fields with a form tag and submit the form. If you want to use $_GET simply assign action='get' on the form. If for some reason this doesn't work for you, you can use javascript to pull the values from the fields and create a url var which you use to redirect (window.location = url). Sorry if I didn't understand your question.

Categories : PHP

Passing text_field input value to a certain controller
Found a solution now: The :event_comment was being transmitted on submit. It is stored in Form Data as event_items[homeprediction]. This is what I did in the event_items controller to access the data: def create @user = User.find(params[:user_id]) event = Event.find(params[:match_id]) comment = params[:event_items] @event_item = @user.event_items.build(event: event, event_comment: comment[:event_comment]) ... end I saved the params[:event_items] hash to a new comment[] hash. And in the new comment[] hash I was able to access the :event_comment passed from the form field_tag. Don't know if this is the most elegant/right way of doing it. But it works for now :-)

Categories : Ruby On Rails

Passing non integer input through console
The first example includes your input. input 12 output 12 13 The second example is exactly this, multiplied 4 times, for each of the 4 numbers received as input. The seperator is "whitespace" - spaces, new lines or tabs. It is not a "non integer", but rather "four integers": The input: 12 12 12 12 is equivalent to 12 12 12 12 output: 12 13 12 13 12 13 12 13

Categories : C++

Passing all input as single params
You can do this in your view: <%= text_field_tag "some_fields[]" %> <%= text_field_tag "some_fields[]" %> <%= text_field_tag "some_fields[]" %> Then in your controller simply retrieve the values using: some_fields = params[:some_fields] # this is an array If you pass values as keys, Rails will give you a Hash: <%= text_field_tag "some_fields[fromdate]" %> <%= text_field_tag "some_fields[todate]" %> In your controller you can do this now: @clients = Customer.search(params[:some_fields]) ^ I added an s to @client since you'll have probably more than one clients matching your criteria.

Categories : Ruby On Rails

PHP session. Passing input value from one to another page
Just reorder the last four lines and you should be good to go: header('Location: http://localhost:8888/stream.php'); mysqli_close ($dbc); session_start(); $_SESSION['cl'] = $_POST['loc']; Into this: session_start(); // even better to put this at the very top of the page $_SESSION['cl'] = $_POST['loc']; mysqli_close ($dbc); header('Location: http://localhost:8888/stream.php'); And don't forget to turn on the sessions on your landing page as well.

Categories : PHP

Passing value of an input control to controller
You should be using the HTML Helpers: @Html.EditorFor(m => m.CommentContent); This will model bind the value in CommentContent (Which should be a property in your model) and pass it back up to the server when the form is POSTED. As an alternative solution, you can also serialize the form and pass it up via AJAX. As @Ic has pointed out you could also use: @Html.TextBoxFor(m => m.CommentContent, new { @class = "form-control" }); Which will change the input type to text and also add your CSS class form-control.

Categories : C#

jQuery + Bootstrap, checkbox button group & select multiple input, submit to form
So, something like this fiddle: $(document).ready(function () { $('div.partnerBtnGroup button').on('click', function (ev) { var btn = $(this).toggleClass('active'); var uid = btn.prop("value"); $("select option[value='" + uid + "']").prop('selected', btn.hasClass('active')); $('pre').html(JSON.stringify($('#partnersSelect').val())); ev.stopPropagation(); }); });

Categories : PHP

HTML input placeholder passing in some invisible value
I believe you may have misunderstood the differences between NULL & isset() In given form that looks like this: <form method='POST'> <input name="curr_loc" type="text" placeholder="Default" /> <input type='submit' /> </form> <?php var_dump(@$_POST['curr_loc']); When you submit a post it will give you string '' (length=0) Which basically means, that a form is submitted, and since all form submission are interpreted as a string however, in this case the 0 indicates, that the value was 0 in length. One the other hand NULL represents a variable who's values are non-existent. Or a variable with no values.

Categories : PHP

Passing form input dynamically to action from erb
When you add or update information via HTTP, it's helpful not to redirect at the end, because you have to use a status code for redirection, when the client really wants a status code that tells it whether the operation was a success. So that you can both be happy, why not supply the same "order" route as both a GET and on a successful POST? e.g. get "/:venue/:table/order" do # get info from storage erb :order end post "/:venue/:table/order" do # get info from params and store it erb :order end The POST route will send back a 200 (or 201) and the stuff you want to show. If the client ever requests to see the order again, they can use the route with a GET request. If the only information about /venue/table/ is in fact an order then I'd drop "order" from the route, but that's j

Categories : Ruby

jsf 1.1 - Passing input value as paramter to action or actionlistner
I'm trying to pass a input value to a jsf action/actionlistner and am having some problems with it: When I try this method, I get EL error saying something about ( is not valid: This is out the box only supported since Servlet 3.0 / EL 2.2. So if you deploy to a Servlet 3.0 compatible container (Tomcat 7, Glassfish 3, etc), then it'll work fine. However, if you're targeting a Servlet 2.5 container (Tomcat 6, Glassfish 2, etc) then you'd need to install JBoss EL in order go be able to use parameterized methods in EL. But if you're targeting a Servlet 2.4 container (Tomcat 5.5, SJAS, etc), then you're completely out of luck. See also: Invoke direct methods or methods with arguments / variables / parameters in EL When I try this method, I'm getting null value in backend bean: e

Categories : JSF

php proc_open passing input to java slow
Inspect your read block in the Java program: Try to use a StringBuilder to concat the data (instead of using += on a String): String in; StringBuilder input = new StringBulider(); br = new BufferedReader(new InputStreamReader(System.in)); while ((in = br.readLine()) != null) { input.append(in + " "); } Details are covered here: Why using StringBuilder explicitly Generally speaking, to make it faster, consider using an application server (or a simple socket based server), to have a permanently running JVM. There is always some overhead when you start a JVM, on top of it the JIT needs some time as well to optimize your code. This effort is lost, after the the JVM exits. As for the PHP program: Try to feed the Java program from the shell, just use cat to pipe the data (on a UNIX sy

Categories : Java

Passing 0 to database but not an empy text input
You want to use isset in this case as it will detect if the textbox is null or not set however it will pass if it is 0 if (isset($_POST['textbox'])) You can further combine it with strlen like this: if (isset($_POST['textbox']) && strlen($_POST['textbox']) > 0)

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.