Search Results

Search found 3666 results on 147 pages for 'mr myo min hein'.

Page 125/147 | < Previous Page | 121 122 123 124 125 126 127 128 129 130 131 132  | Next Page >

  • Java / Spring MVC 3 validation of an email address

    - by Tim
    I have a Java backend with Spring MVC and I am using validation in this way on my domain object for an email address: import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; ... @NotNull @Size(min = 1, max = 100) @Pattern(regexp="^([a-zA-Z0-9\\-\\.\\_]+)'+'(\\@)([a-zA-Z0-9\\-\\.]+)'+'(\\.)([a-zA-Z]{2,4})$") private String email; But all I get with these lines of code Set<ConstraintViolation<Person>> failures = validator.validate(personObject); ... Map<String, String> failureMessages = new HashMap<String, String>(); for (ConstraintViolation<Person> failure : failures) { failureMessages.put(failure.getPropertyPath().toString(), failure.getMessage()); System.out.println(failure.getPropertyPath().toString()+" - "+failure.getMessage()) } I get this on the console: email - must match "^([a-zA-Z0-9\\-\\.\\_]+)'+'(\\@)([a-zA-Z0-9\\-\\.]+)'+'(\\.)([a-zA-Z]{2,4})$" but I have as email address [email protected], so the regexp does not match. So I have two prolems: What's wrong here? And how can I define a error message on my own, because display this to the user, that is not a good thing :-) Thank you in advance for your help and Best Regards.

    Read the article

  • Live clock javascript starts from my custom time

    - by newworroo
    I was trying to create a live/dynamic clock is based on my custom time instead of system time. There are many scripts, but I couldn't find the clock starts from my custom time. Here is an example that I'm trying to modify. The problem is the seconds doesn't change, and it looks like I need to use ajax. Is there any way to do it without ajax? If not, help me to do it using ajax!!! The reason I don't like ajax method is that another page should be called and refreshed, so it will eat server ram. ex) http://www.javascriptkit.com/script/cut2.shtml Before: <script> function show(){ var Digital=new Date() var hours=Digital.getHours() var minutes=Digital.getMinutes() var seconds=Digital.getSeconds() ... ... After: <script> function show(){ var Digital=new Date() var hours=<?php echo $hr; ?>; var minutes=<?php echo $min; ?>; var seconds=<?php echo $sec; ?>; ... ...

    Read the article

  • jQuery not working as expected on HTTPS Internet explorer

    - by jat
    When I try to run my code on any other webbrowsers apart from the Internet explorer it works fine. But when I try to run the code on Internet explorer I do get an alert box saying HERE along with an Ok button. but the problem is when I click on that OK button I do not get anything. Ideally I should be getting another alert box. <!DOCTYPE html> <html> <head> <script src="js/jquery-1.4.2.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#submit").click(function(event) { alert("here"); $.post('process.php', {name:'test1',email:'test.com'}, function(data) { $('#results').html(data); alert(data); }); }); }); </script> </head> <body> <form name="myform" id="myform" action="" method="POST"> <label for="name" id="name_label">Name</label> <input type="text" name="name" id="name" size="30" value=""/> <br> <label for="email" id="email_label">Email</label> <input type="text" name="email" id="email" size="30" value=""/> <br> <input type="button" name="submit" id="submit" value="Submit"> </form> <div id="results"><div> </body> </html> Any help on this is very much appreciated. Edit: I found out that Internet Explorer which has HTTP works perfectly fine but not on Internet Explorer which uses HTTPS.

    Read the article

  • Moq basic questions

    - by devoured elysium
    I made the following test for my class: var mock = new Mock<IRandomNumberGenerator>(); mock.Setup(framework => framework.Generate(0, 50)) .Returns(7.0); var rnac = new RandomNumberAverageCounter(mock.Object, 1, 100); rnac.Run(); double result = rnac.GetAverage(); Assert.AreEqual(result, 7.0, 0.1); The problem here was that I changed my mind about what range of values Generate(int min, int max) would use. So in Mock.Setup() I defined the range as from 0 to 50 while later I actually called the Generate() method with a range from 1 to 100. I ran the test and it failed. I know that that is what it's supposed to happen but I was left wondering if isn't there a way to launch an exception or throw in a message when trying to run the method with wrong params. Also, if I want to run this Generate() method 10 times with different values (let's say, from 1 to 10), will I have to make 10 mock setups or something, or is there a special method for it? The best I could think of is this (which isn't bad, I'm just asking if there is other better way): for (int i = 1; i < 10; ++i) { mock.Setup(framework => framework.Generate(1, 100)) .Returns((double)i); }

    Read the article

  • initialize jquery slider with hidden input value from database.

    - by ludwigs3rd
    I'm using a slider as user input for a screen. Basically it's a bulk update screen where there is a table with multiple rows, thus multiple sliders. I created it so that the hidden value is what gets posted in the form. <td> <input class="percentageProvidedHidden" type="hidden" name='<%= "Values[" + i + "].Percentage" %>' value='<%=item.Percentage %>' /> <div class="percentageProvidedSlider"></div> </td> I have the update working just fine (move slider changes hidden input value, submit, values are updated in db), however, I can't get the damn thing to initialize with the value of the hidden input (note the "value: " parameter below). In this case I think $(this) isn't actually $('percentageProvidedSlider') but the page itself. Can someone help me get the slider value to initialize with the hidden input field? I'm using ASP .Net MVC 2 so if there are any methods I should try with that I welcome them as well. $('.percentageProvidedSlider').slider( { min: 0, max: 100, step: 25, value: $(this).parents('tr').find('input.percentageProvidedHidden').val(), slide: function(e, ui) { var mypos = ui.value; $(this).find('.ui-slider-handle').text(ui.value); }, change: function(event, ui) { var myVal = $(this).slider("option", "value"); $(this).parents('tr').find('input.percentageProvidedHidden').val(myVal); var myDropDown = $(this).parents('tr').find('select.verified'); } });

    Read the article

  • Div Container Cleanup?

    - by Nto
    Just wondering if its possible to cleanup (less code needed to do the same thing) making this div container. Basically it's just a div with a background image however the top & bottom of the div have rounded graphical corners which is why I have a top, middle, and bottom div inside the container div. <div class="fbox"> <div class="ftop"></div> <div class="fmid"> Fullbox Text Goes Here </div> <div class="fbot"></div> </div> Css: .fbox { width: 934px; margin: 0 auto; opacity: 0.70; } .ftop { width: 934px; background:url(../images/cb/full.png) no-repeat 0 -34px; height: 17px; margin:0 } .fmid { width: 894px; padding-left: 20px; padding-right: 20px; background:url(../images/cb/fullmid.png) repeat-y; min-height: 50px; margin:0 } .fbot { width: 934px; background:url(../images/cb/full.png) no-repeat 0 -17px; height: 17px; margin:0 } Outcome: http://img709.imageshack.us/img709/6681/fbox.jpg

    Read the article

  • Intelligently removing excess indention from a string

    - by TravisO
    I'm trying to remove some excessive indention from a string, in this case it's SQL, so it can be put into a log file. So I need the find the smallest amount of indention (aka tabs) and remove it from the front of each line, but the following code ends up printing out exactly the same, any ideas? In other words, I want to take the following SELECT blah FROM table WHERE id=1 and convert it to SELECT blah FROM table WHERE id=1 here's the code I tried and fails $sql = ' SELECT blah FROM table WHERE id=1 '; // it's most likely idented SQL, remove any idention $lines = explode("\n", $sql); $space_count = array(); foreach ( $lines as $line ) { preg_match('/^(\t+)/', $line, $matches); $space_count[] = strlen($matches[0]); } $min_tab_count = min($space_count); $place = 0; foreach ( $lines as $line ) { $lines[$place] = preg_replace('/^\t{'. $min_tab_count .'}/', '', $line); $place++; } $sql = implode("\n", $lines); print '<pre>'. $sql .'</pre>';

    Read the article

  • How do I select every 6th element from a list (using Linq)

    - by iDog
    Hi, I've got a list of 'double' values. I need to select every 6th record. It's a list of coordinates, where I need to get the minimum and maximum value of every 6th value. List of coordinates (sample): [2.1, 4.3, 1.0, 7.1, 10.6, 39.23, 0.5, ... ] with hundrets of coordinates. Result should look like: [x_min, y_min, z_min, x_max, y_max, z_max] with exactly 6 coordinates. Following code works, but it takes to long to iterate over all coordinates. I'd like to use Linq instead (maybe faster?) for (int i = 0; i < 6; i++) { List<double> coordinateRange = new List<double>(); for (int j = i; j < allCoordinates.Count(); j = j + 6) coordinateRange.Add(allCoordinates[j]); if (i < 3) boundingBox.Add(coordinateRange.Min()); else boundingBox.Add(coordinateRange.Max()); } Any suggestions? Many thanks! Greets!

    Read the article

  • sprintf bug with php & apache in windows?

    - by potatoe
    I've run into a strange problem on a WAMP server setup (PHP version 5.3.0, Apache 2.2.11). When using sprintf to output a number, I occasionally get erroneous characters in the output string. Example: (not trimmed from anything, this is the only code in the script) $dt1 = new DateTime('now'); $dt2 = new DateTime('now - 10 min'); $interval = $dt1->diff($dt2); $number = 10.0; $string = sprintf("%.1f", $number); echo "number: $number, string: $string\n"; If I run this at the command prompt with PHP CLI, I get the expected output: number: 10, string: 10.0 However, if I serve it using Apache, in the browser I get number: 10, string: :.0 with a colon where '10' should be. (Note that ':' is the next ascii character in sequence after '9', if $number is 0-9, everything works. Numbers greater than 10 appear to use ascii equivalents - so 11 is ';', 12 is '<', etc.) The strangest part is that the first four lines in the above code sample seem to affect the results. Logically, those statements should have no impact, but if I comment them out or remove them the problem goes away. Any ideas? Anyone else able to replicate this?

    Read the article

  • Background-image is not displaying in Firefox

    - by goa
    Strange thing happens. Background-image is not displaying in Firefox under some versions of WindowsXP and Windows Vista, but displays in Firefox under Mac OSX. It also displays in IE. This is CSS: .cherry_banner { background: url("library/media/images/cherry_banner_top.png") no-repeat; width: 276px; display:block; min-height:100px; padding-top: 13px; color: #fdfdfd; margin-bottom:20px; } .cherry_banner a { color: #fdfdfd; } .cherry_banner a:hover { text-decoration:underline; } .cherry_banner li { list-style-type:none; } .cherry_banner h2 { font-size: 18px; margin-bottom: 10px; } .chb_text1 { background: url("library/media/images/cherry_banner_pixel.png") repeat-y; } .chb_text2 { background: url("library/media/images/cherry_banner_bottom.gif") bottom no-repeat; padding: 4px 14px 24px 25px; } And this is html: <div id="linkcat-8" class="cherry_banner tpt"><div class="chb_text1"><div class="chb_text2"> <h2>??? ?????????</h2> <ul class='xoxo blogroll'> <li><a href="http://inveda.ru/jyotish/naksatra-calendar/">???????? ?????????? ?????????????? ????????? ????????????? ??? ?? 2010?.</a></li> </ul> </div></div></div> You can see on http://www.inveda.ru - right column - red banner.

    Read the article

  • Jquery ajax load not working

    - by Slay
    This is my code: test.html <html> <head> <title>test</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> <script> $(document).ready(function(){ $(window).bind('hashchange', function(){ $('#result').load('test2.html', function(){ alert('Load was performed.'); }); }); }); </script> </head> <body> <a href="#Test1">Test 1</a> <a href="#Test2">Test 2</a> <div id="result"></div> </body> </html> test2.html <h3>This is content from test2.html</h3> I want to detect the specific page to load using window.hash in change. For instance if user go to http://localhost/test.html#test2 The main container(result) in the page will do an ajax load call to test2.html to get the content. I can't manage to get this simple code working. Appreciate if someone can guide me in the right direction. Thanks.

    Read the article

  • Given a vector of maximum 10 000 natural and distinct numbers, find 4 numbers(a, b, c, d) such that

    - by king_kong
    Hi, I solved this problem by following a straightforward but not optimal algorithm. I sorted the vector in descending order and after that substracted numbers from max to min to see if I get a + b + c = d. Notice that I haven't used anywhere the fact that elements are natural, distinct and 10 000 at most. I suppose these details are the key. Does anyone here have a hint over an optimal way of solving this? Thank you in advance! Later Edit: My idea goes like this: '<<quicksort in descending order>>' for i:=0 to count { // after sorting, loop through the array int d := v[i]; for j:=i+1 to count { int dif1 := d - v[j]; int a := v[j]; for k:=j+1 to count { if (v[k] > dif1) continue; int dif2 := dif1 - v[k]; b := v[k]; for l:=k+1 to count { if (dif2 = v[l]) { c := dif2; return {a, b, c, d} } } } } } What do you think?(sorry for the bad indentation)

    Read the article

  • Change cookies when doing jQuery.ajax requests in Chrome Extensions

    - by haskellguy
    I have wrote a plugin for facebook that sends data to testing-fb.local. The request goes through if the user is logged in. Here is the workflow: User logs in from testing-fb.local Cookies are stored When $.ajax() are fired from the Chrome extension Chrome extension listen with chrome.webRequest.onBeforeSendHeaders Chrome extension checks for cookies from chrome.cookies.get Chrome changes the Set-Cookies header to be sent And the request goes through. I wrote this part of code that shoud be this: function getCookies (callback) { chrome.cookies.get({url:"https://testing-fb.local", name: "connect.sid"}, function(a){ return callback(a) }) } chrome.webRequest.onBeforeSendHeaders.addListener( function(details) { getCookies(function(a){ // Here something happens }) }, {urls: ["https://testing-fb.local/*"]}, ['blocking']); Here is my manifest.json: { "name": "test-fb", "version": "1.0", "manifest_version": 1, "description": "testing", "permissions": [ "cookies", "webRequest", "tabs", "http://*/*", "https://*/*" ], "background": { "scripts": ["background.js"] }, "content_scripts": [ { "matches": ["http://*.facebook.com/*", "https://*.facebook.com/*"], "exclude_matches" : [ "*://*.facebook.com/ajax/*", "*://*.channel.facebook.tld/*", "*://*.facebook.tld/pagelet/generic.php/pagelet/home/morestories.php*", "*://*.facebook.tld/ai.php*" ], "js": ["jquery-1.8.3.min.js", "allthefunctions.js"] } ] } In allthefunction.js I have the $.ajax calls, and in background.js is where I put the code above which however looks not to run.. In summary, I have not clear: What I should write in Here something happens If this strategy is going to work Where should I put this code?

    Read the article

  • Cannot select a node here: the context item is an atomic value

    - by user348810
    While i execute this code it shownt the following error Cannot select a node here: the context item is an atomic value,so that i can't sum up the fundunits what is the problem ? why i can't able to sum up <xsl:variable name="VAR_FUNDNAME" select="distinct-values(/SJPDATA/WEALTHSTAT[DOCUMENTTYPE=$MYDCTTYPE]/CLIENTINFO[CLIENTID=$MYCLIENT]/ancestor::*/PORTFOLIO/PENSIONS[CLIENTREF=$MYCLIENTTYPE][GROUPING=$MYGROUPINGVALUE]/PENSIONBREAKDOWN/FUNDNAME)"/> <xsl:for-each select="$VAR_FUNDNAME"> <xsl:variable name="VAR_CURFUNDNAME" select="."/> <myvar><xsl:value-of select="$VAR_CURFUNDNAME"/></myvar> <xsl:if test="(/SJPDATA/WEALTHSTAT[DOCUMENTTYPE=$MYDCTTYPE]/CLIENTINFOCLIENTID=$MYCLIENT]/ancestor::*/PORTFOLIO/PENSIONS[CLIENTREF=$MYCLIENTTYPE][GROUPING=$MYGROUPINGVALUE]/PENSIONBREAKDOWN[FUNDNAME=string($VAR_CURFUNDNAME)][UNITTYPE='Acc'])"/> <ASSETVALUATIONDATE><xsl:value-of select="min(/SJPDATA/WEALTHSTAT[DOCUMENTTYPE=$MYDCTTYPE]/CLIENTINFO[CLIENTID=$MYCLIENT]/ancestor::*/PORTFOLIO/PENSIONS[CLIENTREF=$MYCLIENTTYPE][GROUPING=$MYGROUPINGVALUE]/PENSIONBREAKDOWN[FUNDNAME=string($VAR_CURFUNDNAME)][UNITTYPE='Acc']/string(ASSETVALUATIONDATE))"/></ASSETVALUATIONDATE> <PLANNUMBER></PLANNUMBER> <FUNDNAME><xsl:value-of select="$VAR_CURFUNDNAME"/></FUNDNAME> <FUNDUNITS><xsl:value-of select="string(sum(/SJPDATA/WEALTHSTAT[DOCUMENTTYPE=$MYDCTTYPE]/CLIENTINFO[CLIENTID=$MYCLIENT]/ancestor::*/PORTFOLIO/PENSIONS[CLIENTREF=$MYCLIENTTYPE][GROUPING=$MYGROUPINGVALUE]/PENSIONBREAKDOWN[FUNDNAME=string($VAR_CURFUNDNAME)][UNITTYPE='Acc']/FUNDUNITS))"/></FUNDUNITS> </xsl:for-each>

    Read the article

  • Extend footer wrap to width of page.

    - by hawkeye126
    I've made a footer wrap outside the content wrap (which everything else is in). I would like to make the footer wrap extend to fill the width of the page and I would like it to be fixed on the bottom. Here's the code: footerWrap { background-color:#000; width: auto; } footer { margin: auto; text-align:center; width:965px; height:150px; background-color:#000; border:#000 inset medium; } The website is item9andthemadhatters.com please let me know if you need any other code or info. Thanks!! update: html { padding:0; height:100%; width: 100%; } body{ margin: -1px 0 0 0; background-color:#FFF; font-family: calibri; background-image:url(images/item9HeaderSideFiller.gif); background-repeat: repeat-x; padding:0; height:100%; width: 100%; } wrap { width: 965px; margin:auto auto; min-height:462px; max-height:4000 px; footerWrap { background-color:#000; position:absolute; bottom:0; width:100% } footer { margin: auto; text-align:center; width:965px; height:150px; background-color:#000; } }

    Read the article

  • How to get attributes from both relative and absolute positioning

    - by user3677286
    I have a footer that i want to attach to the bottom of the page using bottom:0px. However, I also want to center it by using margin-left:auto; and margin-right:auto;. Effectively, this will stick the footer to the bottom of the page while keeping it centered vertically. Unfortunately, these cannot be used together as bottom:0px requires position:relative while margin-left:auto and margin-right:auto require position:absolute. How can I get both of these attributes onto the same div without creating a container? If not possible, what is a clean way of getting both these attributes? ALSO: I do NOT want to have a fixed position. footer.css: .footer { /*background-color:blue;*/ min-height:10px; width:940px; margin-top:5px; margin-left:auto; /* WILL ONLY WORK IF POSITION IS RELATIVE */ margin-right:auto; padding:5px; display:block; border-top: 3px solid #CCCCCC; text-align: center; font-family:arial; color:gray; position: relative; bottom:0px; /* WILL ONLY WORK IF POSITION IS ABSOLUTE */ } Thanks.

    Read the article

  • need help speeding up tag cloud filter for IE

    - by rod
    Hi All, Any ideas on how to speed this up in IE (performs decent in Firefox, but almost unusable in IE). Basically, it's a tag cloud with a filter text box to filter the cloud. <html> <head> <script type="text/javascript" src="jquery-1.3.2.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#tagFilter').keyup(function(e) { if (e.keyCode==8) { $('#cloudDiv > span').show(); } $('#cloudDiv > span').not('span:contains(' + $(this).val() + ')').hide(); }); }); </script> </head> <body> <input type="text" id="tagFilter" /> <div id="cloudDiv" style="height: 200px; width: 400px; overflow: auto;"> <script type="text/javascript"> for (i=0;i<=1300;i++) { document.write('<span><a href="#">Test ' + i + '</a>&nbsp;</span>'); } </script> </div> </body> </html> thanks, rodchar

    Read the article

  • simple jQuery script not running

    - by romaer
    I just have copied a simple script from W3School and cannot get it running: Here it is: <!DOCTYPE html> <html> <head> <script type="text/javascript" src="http://Web Testing/js/jquery-1.8.0.min.js"> </script> <script> $(document).ready(function(){ $("p").click(function(){ $(this).hide(); }); }); </script> </head> <body> <p>If you click on me, I will disappear.</p> <p>Click me away!</p> <p>Click me too!</p> </body> </html> It works on their Tryit Editor with the following line but does not work even with this line on my Mac under BBEdit

    Read the article

  • Find existence of number in a sorted list in constant time? (Interview question)

    - by Rich
    I'm studying for upcoming interviews and have encountered this question several times (written verbatim) Find or determine non existence of a number in a sorted list of N numbers where the numbers range over M, M N and N large enough to span multiple disks. Algorithm to beat O(log n); bonus points for constant time algorithm. First of all, I'm not sure if this is a question with a real solution. My colleagues and I have mused over this problem for weeks and it seems ill formed (of course, just because we can't think of a solution doesn't mean there isn't one). A few questions I would have asked the interviewer are: Are there repeats in the sorted list? What's the relationship to the number of disks and N? One approach I considered was to binary search the min/max of each disk to determine the disk that should hold that number, if it exists, then binary search on the disk itself. Of course this is only an order of magnitude speedup if the number of disks is large and you also have a sorted list of disks. I think this would yield some sort of O(log log n) time. As for the M N hint, perhaps if you know how many numbers are on a disk and what the range is, you could use the pigeonhole principle to rule out some cases some of the time, but I can't figure out an order of magnitude improvement. Also, "bonus points for constant time algorithm" makes me a bit suspicious. Any thoughts, solutions, or relevant history of this problem?

    Read the article

  • method works fine, until it is called in a function, then UnboundLocalError

    - by user1776100
    I define a method called dist, to calculate the distance between two points which I does it correctly when directly using the method. However, when I get a function to call it to calculate the distance between two points, I get UnboundLocalError: local variable 'minkowski_distance' referenced before assignment edit sorry, I just realised, this function does work. However I have another method calling it that doesn't. I put the last method at the bottom This is the method: class MinkowskiDistance(Distance): def __init__(self, dist_funct_name_str = 'Minkowski distance', p=2): self.p = p def dist(self, obj_a, obj_b): distance_to_power_p=0 p=self.p for i in range(len(obj_a)): distance_to_power_p += abs((obj_a[i]-obj_b[i]))**(p) minkowski_distance = (distance_to_power_p)**(1/p) return minkowski_distance and this is the function: (it basically splits the tuples x and y into their number and string components and calculates the distance between the numeric part of x and y and then the distance between the string parts, then adds them. def total_dist(x, y, p=2, q=2): jacard = QGramDistance(q=q) minkowski = MinkowskiDistance(p=p) x_num = [] x_str = [] y_num = [] y_str = [] #I am spliting each vector into its numerical parts and its string parts so that the distances #of each part can be found, then summed together. for i in range(len(x)): if type(x[i]) == float or type(x[i]) == int: x_num.append(x[i]) y_num.append(y[i]) else: x_str.append(x[i]) y_str.append(y[i]) num_dist = minkowski.dist(x_num,y_num) str_dist = I find using some more steps #I am simply adding the two types of distance to get the total distance: return num_dist + str_dist class NearestNeighbourClustering(Clustering): def __init__(self, data_file, clust_algo_name_str='', strip_header = "no", remove = -1): self.data_file= data_file self.header_strip = strip_header self.remove_column = remove def run_clustering(self, max_dist, p=2, q=2): K = {} #dictionary of clusters data_points = self.read_data_file() K[0]=[data_points[0]] k=0 #I added the first point in the data to the 0th cluster #k = number of clusters minus 1 n = len(data_points) for i in range(1,n): data_point_in_a_cluster = "no" for c in range(k+1): distances_from_i = [total_dist(data_points[i],K[c][j], p=p, q=q) for j in range(len(K[c]))] d = min(distances_from_i) if d <= max_dist: K[c].append(data_points[i]) data_point_in_a_cluster = "yes" if data_point_in_a_cluster == "no": k += 1 K[k]=[data_points[i]] return K

    Read the article

  • div on other div

    - by Gisinior
    i have: <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <style type="text/css"> #ONE { background-color: #888; width: 500px; height: 500px; } #TWO { background-color: blue; width: 50px; height: 50px; } #THREE { background-color: yellow; width: 200px; height: 200px; display: none; } #four { background-color: red; width: 200px; height: 200px; } </style> <script type="text/javascript"> $(document).ready( function() { $("#TWO").click( function() { $("#THREE").toggle(); }); }); </script> <div id="ONE"><div id="TWO"></div><div id="four"></div><div id="THREE"></div></div> default click for blue div how can i it make? best with transparent :)

    Read the article

  • jQuery: serializing array returns empty string

    - by John Smith
    I did not forget to add name attributes as is a common problem and yet my serialized form is returning an empty string. What am I doing wrong? HTML/javascript: <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> <script> $( document ).ready( function() { $('#word_form').submit(function(e) { e.preventDefault(); console.log($(this).serialize()); //returns an empty string }); }); </script> </head> <body> <div id="wrapper"> <form name="word_form" id="word_form" method="POST"> <input type="image" name="thumbsUp" id="thumb1" value="1" src="http://upload.wikimedia.org/wikipedia/commons/8/87/Symbol_thumbs_up.svg" style="width:50px;height:50px;"> <input type="image" name="thumbsDown" id="thumb2" value="2" src="http://upload.wikimedia.org/wikipedia/commons/8/84/Symbol_thumbs_down.svg" style="width:50px;height:50px;"> </form> </div> </body> Thanks!

    Read the article

  • How to use scrollTop in jQuery when scrolling within a div?

    - by sharataka
    I am trying to get the scrollTop using jQuery to work when the content I am trying to scroll to is located in within a div. The current implementation doesn't do anything javascript <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <script> $(document).ready(function (){ //$(this).animate(function(){ $('html, body').animate({ scrollTop: $("#test4").offset().top }, 2000); //}); }); </script> html <div class="row"> <div class = "span12"> <div class = "row"> <div class = "span2"> <div style="height:480px;font:12px Georgia, Garamond, Serif;overflow:auto;"> <div id = "test1">Test1</div> <div id = "test2">Test2</div> <div id = "test3">Test3</div> <div id = "test4">Test4</div> </div> </div> <div class = "row"> <div class = "span8"> Other content on the page </div> </div> </div> </div> </div>

    Read the article

  • DropDownList not working 100% in ASP.Net MVC

    - by Program.X
    I am quite confused with how to effectively use the Html.DropDownList helper for ASP.NET MVC. Background: I have a 5-page form, which saves data to the form each time "Next" is clicked. Users may navigate back and forth between sections, so previous sections will already be pre-populated with previously-entered data. This works for TextBoxes. But not DropDownLists. I have tried a load of different methods, including: http://stackoverflow.com/questions/867117/how-to-add-static-list-of-items-in-mvc-html-dropdownlist/867218#867218 http://stackoverflow.com/questions/2080802/setting-selected-item-to-dropdownlist-in-mvc-application I have a ViewModel such taht I have got my lists and my Model (a LINQ-to-SQL generated class) as properties. eg: public class ConsultantRegistrationFormViewModel { public IConsultantRegistration ConsultantRegistration { get; private set; } public SelectList Titles { get; private set; } public SelectList Countries { get; private set; } public SelectList Currencies { get; private set; } public int CurrentSection { get; private set; } private ConsultantRegistrationFormViewModel(IConsultantRegistration consultantRegistration) { ConsultantRegistration = consultantRegistration; CurrentSection = 1; Titles = new SelectList(new string[] { "Mr", "Mrs", "Miss", "Ms", "Dr", "Sir" }); Countries = new SelectList(countries.Select(q => q.Name)); Currencies = new SelectList(currencies,"CurrencyCode","FriendlyForm"); } } My Controller's Edit Action on GET looks like: public class ConsultantRegistrationController : Controller { public IConsultantRegistrationRepository ConsultantRegistrationRepository { get; private set; } public ICountryRepository CountryRepository { get; private set; } public IEnumerable<ICountry> Countries { get; private set; } public ConsultantRegistrationController() { ConsultantRegistrationRepository = RepositoryFactory.CreateConsultantRegistrationRepository(); CountryRepository = RepositoryFactory.CreateCountryRepository(); Countries = CountryRepository.GetCountries().ToArray(); } public ActionResult Edit(Guid id, int sectionIndex) { IConsultantRegistration consultantRegistration = ConsultantRegistrationRepository.GetConsultantRegistration(id); SelectList bankBranchCountriesSelectList = new SelectList(Countries, "BankBranchCountry", "CountryName", consultantRegistration.BankBranchCountry); ViewData["bankBranchCountrySelectList"] = bankBranchCountriesSelectList; return View(new ConsultantRegistrationFormViewModel(consultantRegistration,sectionIndex, Countries,Currencies)); } } With my View doing: <%: Html.DropDownList("ConsultantRegistration.BankBranchCountry",ViewData["bankBranchCountrySelectList"] as SelectList) %> This gives me the error: DataBinding: 'IWW.ArrowPay.ConsultantRegistration.Data.Country' does not contain a property with the name 'BankBranchCountry'. Which it does, have a look at the schema of this property: public interface IConsultantRegistration { Guid ID { get; set; } [DisplayName("Branch Country")] string BankBranchCountry { get; set; } } (My LINQ-to-SQL type ConsultantRegistration implemented IConsultantRegistration) It seems that it is trying to bind to the wrong type, though? If I use this in my view (and use my Controller's Countries property): <%: Html.DropDownList("ConsultantRegistration.BankBranchCountry ",Model.Countries,"(select a Country)") %> I get the saved value fine, but my model doesn't update on POST. And if I use this in my view: <%: Html.DropDownListFor(model=>model.ConsultantRegistration.BankBranchCountry ",Model.Countries,"(select a Country)") %> I get the list, and it POSTs the selected value back, but does not pre-select the currently selected item in my model on the view. So I have a bit of the solution all over the place, but not all in one place. Hope you can help fill in my ignorance.

    Read the article

  • Getting a Script Error Every Time I Click a Link

    - by Flip4Life
    I have everything working perfectly on my site, but for some reason, I get an error message in console whenever I click a link anywhere on my site. The error has to do with this line of coding here: jQuery(function($){ $('.navbar a, .scroll a, .smoothscroll a').bind('click',function(event){ var $anchor = $(this); $('html, body').stop().animate({ scrollTop: $($anchor.attr('href')).offset().top }, 850,'easeInOutExpo'); event.preventDefault(); }); }); And the error I am getting is this: "SCRIPT5007: Unable to get value of the property 'top': object is null or undefined custom.min.js, line 6 character 197" The exact code it is highlighting is this part of the above code: $('html, body').stop().animate({ scrollTop: $($anchor.attr('href')).offset().top }, 850,'easeInOutExpo') All I know is that when I remove the above code, my scroll-to links stop working on pages such as these: http://www.northtownsremodeling.com/things-to-know.php You can see the popup error happen and stay in the console easily by going to a page with a filter like this: http://www.northtownsremodeling.com/bathroom/ And clicking one of the filter buttons. Ultimately, I am trying to make it so my scroll-to setting still works, but not have that error come up anymore. I made this script a long time ago, and I'm really confused as to what could be causing this error when everything is functioning perfectly otherwise? Thanks!

    Read the article

< Previous Page | 121 122 123 124 125 126 127 128 129 130 131 132  | Next Page >