w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
fill select input value dirrectly without java script
Assuming Idtbl_bank is the model field in which you want to store the selected value (and also assuming that tbl_bank.id and Idtbl_bank are compatible types): @Html.DropDownListFor(m => m.Idtbl_bank, ViewBag.BankNames, "id", "namebank") If you look at what this renders, you'll see that the key is the name attribute of the select element: <select id="Idtbl_bank" name="Idtbl_bank" class="span5"> The name determines what the form field is submitted as, not the id attribute.

Categories : Asp Net Mvc

run php script when input text changes in html textbox
PHP is server side scripting language, so when you submit the form then it will check the value of both textboxes.. Instead of PHP you can use JavaScript or jQuery or AJAX to check the value of both text box.

Categories : PHP

Script not posting input to PHP server script.
Your dataString is incorrect, you forgot a '&' between vars : var dataString = 'mac=' + mac + '&store=' + store; Plus there is no need for a string, just pass an object, jQuery will do the rest : $.ajax({ type: 'POST', url: 'ajax/subscribe.php', data : {mac: mac, store: store}, etc...

Categories : PHP

how to make a php/ajax script to show text depending on function of php script
Add a div to your 'myDiv' call it with an id 'message' and change it with javascript accordingly when calling the functions? $('#ajaxMessage').html('My message'); Hopefully this answers your question.

Categories : PHP

How to use a javascript Randomizer script to link into an iframe so that i can open from a list of links in the script
If I understand correctly, you want to load the URL in an iframe, and show the chosen URL somewhere on the website. Change your function to: <script type="text/javascript"> var url=[ 'http://www.fallingfalling.com', 'http://www.omfgdogs.com', ]; window.onload=function() { var theURL = url[Math.floor(Math.random()*url.length)]; document.getElementById('trig').onclick=function() { location.href=theURL; }} document.getElementById('chosenURL').innerHTML = '<a href="'+theURL+'">'+theURL+'</a>'; </script> Then add this HTML to your page, there where you want the text: <div id="chosenURL"></div>

Categories : Javascript

pass partial list of arguments from the parent script to the child script
Use shift to remove the first two arguments: shift 2 child_script "$@" If you need to use $1 and $2, you can save them in variables first. Another option is to assign the arguments to an array: args=("$@") remove the first two elements of the array: unset args[0] unset args[1] Then call the child script with this array: child_script "${args[@]}"

Categories : Bash

Append text in html tag. Javascript issue
Do the other way round, via JS (using jQuery): <script type="text/javascript"> $(".muted").html(getGenericObjName("{{n.news_type}}",{{n.news.object_id}})); </script> HTML: <span class="muted"></span>

Categories : Javascript

My jQuery script only runs once when I select a value
You need to bind the change event to make it work on change of select $('#integrantes').change(function(){ var number= $('#integrantes :selected').val(); if(number==3){ $("#loscuatro").hide(); $("#loscinco").hide(); $("#losseis").hide(); $("#lossiete").hide(); $("#losocho").hide(); $("#losnueve").hide(); $("#losdiez").hide(); }else if(number==4){ $("#loscinco").hide(); $("#losseis").hide(); $("#lossiete").hide(); $("#losocho").hide(); $("#losnueve").hide(); $("#losdiez").hide(); }else if(number==5){ $("#losseis").hide(); $("#lossiete").hide(); $("#losocho").hide(); $("#losnueve").hide(); $("#losdiez").hide();

Categories : Jquery

how to add inside a text box?
I want to alert('test'); in an input type text but it should not execute the alert(alert prompt). <input type="text" value="<script>alert('test');</script>" /> Produces: You can do this programatically via JavaScript. First obtain a reference to the input element, then set the value attribute. var inputElement = document.querySelector("input"); inputElement.value = "<script>alert('test');</script>";

Categories : Javascript

jQuery script for checking if input has any value. Issue in IE and Chrome
There is a typo in your code ' is missing after selector Use $('.comment_input') instead of $('.comment_input) In line $('.comment_input).keyup(function(){ Edit: use .prop() instead of .attr() Working code JS: $('.comment_button').prop('disabled', true); $('.comment_input').keyup(function () { $('.comment_button ').prop('disabled', $.trim($(this).val()).length == 0); }); HTML: <input type="text" class="comment_input" name="somethng"/> <button class="comment_button">something</button> Fiddle Demo

Categories : Javascript

My jQuery script makes always the first
You have all <div>s with the same ID. You should not duplicate the IDs. They should be unique. And also, a <label> cannot have a <div> inside it. Since you are using $("#select"), it selects only the first <div>. Make sure your IDs are unique and try it. This code works for you: $(document).ready( function(){ $('select').focus( function(){ $(this).closest("div").addClass('selected'); }); $('select').focusout( function(){ $(this).closest("div").removeClass('selected'); }); }); Fiddle: http://jsfiddle.net/praveenscience/TeNaf/2/

Categories : Jquery

Preventing layout break using jQuery when entering "" via Ajax
It's simple. Do not use jQuery's .html(), use .text(). Escaping will occur automatically, there is nothing special you need to do apart from not using the wrong API function. <div id="textDisplay"></div> <input type="text" id="enteredText"> <button id="transferText">Click!</button> and $(function() { $("#transferText").click(function () { var userInput = $("#enteredText").val(); $("#textDisplay").text(userInput); }); });

Categories : Javascript

Jquery script for checking if input is not empty. A space button issue
trim the value using trim() and then check for the length if you don't want to send just the spaces. $(document).ready(function () { $('.post_button').attr('disabled', true); $('.message').keyup(function () { if ($.trim($(this).val()).length != 0) { $('.post_button').attr('disabled', false); } else { $('.post_button').attr('disabled', true); } }) }); Use $.trim($(this).val()) as $(this).val().trim() doesn't work in IE8.

Categories : Javascript

Jquery. Script changes value in input field. Than based on value in the input field need to execute if statement
you are adding your if condition separately, you need to add it inside your change event, like: $(".exchange_rate_changed_test1").on("change", function () { $('#is_exchange_rate_changed_test1').val(1).change(); if ($("#is_exchange_rate_changed_test1").val() > 0) { alert("Test"); } });

Categories : Javascript

java script filling up an array so it matches following structure
Is this what you mean? var object1 = { label: 'node1', children: [ { label: 'child1' }, { label: 'child2' } ] }; var data = new Array(); data.push(object1); OR data.push({ label: 'node1', children: [ { label: 'child1' }, { label: 'child2' } ] }); EDITED TO SHOW YOSHIS VERSION ASWELL

Categories : Javascript

Replace text with images in jQuery script
Try using this: $('#about, #subscribe, #contact').hide(); $('.home').click(function () { var id = this.id.replace('show_', ''); // this line has been changed var $content = $('#' + id + ':not(:visible)'); if ($('.current').length === 0) { showContent($content) } else { $('.current').fadeOut(600, function () { showContent($content) }); } }); function showContent(content) { content.fadeIn(600); $('.current').removeClass('current'); content.addClass('current'); } When you click on a link it takes the link's id then removes show_ and shows the div with that id. Here's an example: A user clicks the top link. The id is show_about. The javascript removes show_ leaving about then selects $('#about:not(:visible)'); and fad

Categories : Javascript

jQuery get text/html/json vs. script
It looks like you're trying to load a script from an external resource. This can be potentially dangerous, so you're prevented from loading external resources for reasons such as the one provided here: Imagine that you are checking some stuff on your ebay account. Then in another tab you open my site, where I have a script that makes a series of requests to ebay (you are still logged in) and bids you for an Audi A8 without you even noticing. Annoying... If it was your bank it can directly steal money from you. I won't attempt to explain why you're script is failing to load, other than noting the obvious: you're trying to load a JavaScript file as plain text. jQuery is probably subverting the restrictions silently by adding a script element into your document with the given src attrib

Categories : Javascript

Komodo Edit - Autocomplete filling script tag with wrong attributes
Komodo dev here, this is because "script" triggers an auto-abbreviation. Which is a snippet in your toolbox with the name "script" which has the "Auto-Abbreviation" toggle enabled. Please have a look at the Snippets documentation: http://docs.activestate.com/komodo/8.0/snippets.html You can turn this off either specifically for "script" by toggling the "Auto-Abbreviation" checkbox or globally by toggling "Enable Auto-Abbreviations" under Preferences > Editor > Smart Editing, in this same area you can also change what would trigger these auto-abbreviations. For example I have it configured to only trigger on " " (TAB) so that can press TAB to trigger an abbreviation.

Categories : Misc

Bash script to wait for gnome-terminal to finish before continuing script, only works for first instance of script
#!/bin/bash date bash -c "sleep 7" & bash -c "sleep 5" & wait date As you can see while running this script, both sleep commands will run in parallel, but main thread stalls, while they are running. Sat. Jule 27 01:11:49 2013 Sat. Jule 27 01:11:56 2013 Replace sleep 7 with expect launchneuron.exp and sleep 5 with expect launchmpj.exp and add your plot commands after calling "wait": echo "Simulation Complete" ...(your code to plot results)

Categories : Bash

PowerShell - script 1 calls script 2 - how to return value from script 2 to script 1
You could make use of ProcessStartInfo and Process which would allow you to read the StandardOutput. Here's an example of what you might do: $startInfo = New-Object System.Diagnostics.ProcessStartInfo $startInfo.FileName = "powershell.exe" $startInfo.Arguments = "C:scriptscript2.ps1" $startInfo.RedirectStandardOutput = $true $startInfo.UseShellExecute = $false $startInfo.CreateNoWindow = $false $startInfo.Username = "DOMAINUsername" $startInfo.Password = $password $process = New-Object System.Diagnostics.Process $process.StartInfo = $startInfo $process.Start() | Out-Null $standardOut = $process.StandardOutput.ReadToEnd() $process.WaitForExit() # $standardOut should contain the results of "C:scriptscript2.ps1" $standardOut

Categories : Powershell

Change text input name attribute to match value from select list
$(this).nextAll('input[type="search"]').attr('name',value); http://jsfiddle.net/FyLr9/3/ From Omar's comment just use the id to select the element $(this).nextAll('#search').attr('name',value);

Categories : Jquery

select input inside list based on value using JQuery
If you are using jQuery >= 1.6: var desiredValue = 10; // or whatever value you need to disable $("input[type=radio][value=" + desiredValue + "]").prop("disabled",true); & If you are using jQuery < 1.6 do this: var desiredValue = 10; // or whatever value you need to disable $("input[type=radio][value=" + desiredValue + "]").attr("disabled","disabled");

Categories : Javascript

How to add the script to the top of script list in Joomla 2.5
You'll need to modify your template's index.php file. The following includes Joomla's head section: <jdoc:include type="head"/> Simply move $doc->addScript after this (or before it) to set which loads first. Files load top to bottom, so whatever is on top will load first.

Categories : PHP

Powershell start-process script calls a second script - how to make one script only
Windows does not allow a process to elevate while running. There are some tricks but in one way or another they will spawn a new process with the elevated rights. See here for more info. So the easiest way for PowerShell is still using one script to Start-Process the other script elevated.

Categories : Powershell

Google Apps Script Spreadsheets - Assign script to image from a script
This would be a cool feature, but here is a possible workaround, it might even offer more functionality. You can build a UI using Google API. More detailes here. The UI allows you to create side bars/menus/etc. You could even create floating dialog windows. Using AbsolutePanel, you can even choose where the dialogue shows up.

Categories : Google Apps Script

unable to access variable declared in ksh script to csh script using shell script
The ksh script is not doing what you think it is doing when used by ksh; it sets $1 first to MyUser=root and then MyPassword=shroot. However, when you source it from your C shell script, because the syntax is compatible with C shell (checked with tcsh), you would set the two variables. If you sourced the script from a Bourne-shell derivative, the exit at the end of the ksh script would cause the shell to exit; it does not seem to cause the C shell to exit. So, what you've got is a weird hybrid. Normally, you stick to one language and use it exclusively. Where you need to use another shell, you can do so, but you simply run the script written for the other shell. You can communicate to the other script with environment variables. You don't normally try writing sourceable code that ca

Categories : Shell

Filling
You have to set the value and text of select html control. The sintaxe is: <option value='your value'>text</option> Try something like this: <select> @foreach (var item in Model) { <option value='@item.ResponseIdentifier'>@item.ResponseIdentifier</option> } </select> Or, in my opinion it is better. Your action on the controller, you could define a key on the ViewBag to fil lthe dropdownList, for sample: ViewBag.Cities = new SelectList(new[] { new { Id = "1", Name = "New York" }, new { Id = "2", Name = "São Paulo" }, new { Id = "3", Name = "London" }, }, "Id", "Name"); To fill this ViewBag, it could come from a database or xml file, anywhere. In your View, your could use this item on ViewBag to fill a DropDownList

Categories : C#

JQuery function when onchange of select box value add attr disabled to input[text],
Better attach an event handler using .on() Attach an event handler function for one or more events to the selected elements. (1) On changing the SELECT, disable the textbox $('#subject_items').on('change', function(){ $('#txtsubitems').attr("disabled", "disabled"); }); Similarly (2) On changing the INPUT, disable the select $('#txtsubitems').on('change', function(){ $('#subject_items').attr("disabled", "disabled"); }); I can't check this with your site, rather here is a fiddle UPDATES: From your comments, $('#subject_items').on('change', function () { console.log($(this).val()); if ($(this).val() !== 'none') { $('#txtsubitems').prop("disabled", true); } else { $('#txtsubitems').prop("disabled", false); } }); $('#txtsubit

Categories : Javascript

AHK Script Issues
When you run this code, you get an error message "error at line 80". So this is where you should look. Line 80 is barrel.{enter} and that's just leftover from line 78. If you get a text editor that displays line numbers this will be easy to fix. You have 20-30 lines in the script that have these problems so you can fix them one by one. The error messages will show you which line to fix.

Categories : Performance

JQuery 1.9.0 minified can't select the text or value from a dropdown list?
You're selecting your select by id but it has only a name. Change $("#formulas option:selected") to $("select[name=formulas] option:selected") Or, better, give it also an id : <select id=formulas name="formulas">

Categories : Javascript

Issues with Wall Script
I think the problem is in this statement: $qfu = "SELECT * FROM my_friends WHERE (user_id = '$user_id' OR friend_id = '$user_id') AND status = '1'"; - if you have 5 friends your id will appear 5 times in result and thus will get this own post 5 times. You should get rid of the user_id = '$user_id' part of the query: $qfu = "SELECT * FROM my_friends WHERE friend_id = '$user_id' AND status = '1'"; - this way you get your friends only. You already have your own id, so no need to query for it. Now you need to put the code for fetching messages into separate function and you are ready: function getMessagesById($authorId) { $querymsgs = "SELECT * FROM messages where uid_fk = '$authorId' order by msg_id DESC"; $qmsgs = mysql_query($querymsgs) or die(mysql_error()); $row_msgs =

Categories : PHP

jQuery make an input text into read only when one value is selected from drop down list
use select change() event to get the selected value and prop() to change the readonly property of input $('#prd_dtype1').change(function(){ if(this.value == ""){ $('#prd_damount1').prop('readonly',true); } else{ $('#prd_damount1').prop('readonly',false); } }).change(); //<--- calling the change event here to make sure change event is called as soon as the document is ready ... OR The easy way (without the conditions) $('#prd_dtype1').change(function(){ $('#prd_damount1').prop('readonly',!this.value); }).change(); and just incase if you need the input value to be empty when none is selected then you can use $('#prd_damount1').val(''); inside the if condition of first answer. fiddle here

Categories : Jquery

Issues with the script on ajax request
After you do renderPartial and load your content with ajax you load your scripts once more. For example you got some jQueryUI datepicker, it wont work inside of rendered part. Even if you'll register script right and so on you'll need to reinit object to make your widget work. Load your scripts in rendered part is very bad idea cause you'll have double loads. Then you'll need to delete scripts from script map and load on your pages them with your hands. So load all scripts on your page. Add this: `if (Yii::app()->request->getIsAjaxRequest()) { Yii::app()->clientScript->scriptMap['*.js'] = false; Yii::app()->clientScript->scriptMap['*.css'] = false; $this->renderpartial('someview',array()) } ` Actually this works but its efficient and bad. I had similar problem. My solution is simp

Categories : PHP

Upload CSV to MySQL with PHP script. Issues
Just truncate your table every time its far easier. This is a basic importer I wrote last night for a friend its only simplistic but you should get the idea. Obviously I use mysqli here so you need to change that bit to suit yours and you also have to add in the truncate at the top (just after the starting import bit will be fine. if (isset($_POST['action']) && $_POST['action']=="beginimport") { echo "<h4>Starting Import</h4><br />"; // Ignore user abort and expand time limit //ignore_user_abort(true); set_time_limit(60); $result = @move_uploaded_file($_FILES['clientimport']['tmp_name'], getcwd()."/tmp/siccodes.csv"); if(empty($result)){ echo "<span style="font-weight:bold;color:red;">There was an error moving the uploaded

Categories : PHP

Bash script: spawning multiple processes issues
At the very least, this line: `process $j &` Shouldn't have any backticks in it. You probably just want: process $j & Besides that, you're overwriting your log files instead of appending to them; is that intended?

Categories : Bash

Google Tracking Script causing Website Layout issues
I have figured it out: <div style="display:none"> <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"></script> </div> Thanks to this posting: Google AdWords: remove iframe added by tracking conversion code

Categories : Javascript

Change encoding of text file (shell archive or script for antique kernel text to ASCII text, with CRLF, LF line terminators)
Unix uses a single character for line termination. If you want to convert your file with CRLF to single character termination, you can do the following: sed -e 's/<CTRL-V><CTRL_M>//' filename where <CTRL-V> is the Control key pressed with V (do not include < and > characters in the command.

Categories : Bash

for loop over Model List in MVC script and access Jquery inside loop
Looks like your selector #contactPhone select don't works cause select control also has contactPhone id. Check with .appendTo('#contactPhone'). BTW, you can use helper to populate dropdown list with your model: @{ new list = Model.worklist.Select(x => new SelectListItem { Text = x.PhoneNumber.ToString(), Value = x.PhoneNumber.ToString() }).ToList(); } @Html.DropDownListFor(model => model.PhoneNumber, list, new { id = "contactPhone" })

Categories : Javascript

Invoke python script from another python script and set execution directory of the executed script
You could use cwd parameter, to run scriptB in its directory: import os from subprocess import check_call check_call([scriptB], cwd=os.path.dirname(scriptB))

Categories : Python

How to detect current input-text's index from an array of input-text with jquery
.index() gets the element's current position relative to it's siblings. You should use a regex to get the number between [ and ] in the input's name. Use this instead: $('input[name^=quantity]').change(function () { var index = $(this).prop('name').match(/[(.*?)]/)[1]; alert(index); }); Here it is working: http://jsfiddle.net/u8HRq/1/ UPDATE: Based on your update here's a working fiddle: http://jsfiddle.net/qbmAU/2/ First off ids should be unique so I've changed them to classes and updated the selector for the change event. I've also got .index() working: $(this).index('.quantity') index() usually works by returning the position relative to the matching siblings which is why mine and j08691's answers were working. However, if the elements aren't siblings then you can pas

Categories : Javascript



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