Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6712177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:13:43+00:00 2026-05-26T08:13:43+00:00

Check this JSFiddle to see my problem. I am selecting a time from td

  • 0

Check this JSFiddle to see my problem.

I am selecting a time from td and want to select an option from drop down based on that.

It’s working fine in IE8 and down. But not working in Chrome and IE9.

HTML

<table>
    <tr>
        <td id="time">
            11:20:12
        </td>
    </tr>
</table>

<select id="StartHour" name="DateRangeFromSeconds">
    <option value="00">00</option>
    <option value="01">01</option>
    <option value="02">02</option>
    <option value="03">03</option>
    <option value="04">04</option>
    <option value="05">05</option>
    <option value="06">06</option>
    <option value="07">07</option>
    <option value="08">08</option>
    <option value="09">09</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
    <option value="13">13</option>
    <option value="14">14</option>
    <option value="15">15</option>
    <option value="16">16</option>
    <option value="17">17</option>
    <option value="18">18</option>
    <option value="19">19</option>
    <option value="20">20</option>
    <option value="21">21</option>
    <option value="22">22</option>
    <option value="23">23</option>
    <option value="24">24</option>
    <option value="25">25</option>
    <option value="26">26</option>
    <option value="27">27</option>
    <option value="28">28</option>
    <option value="29">29</option>
    <option value="30">30</option>
    <option value="31">31</option>
    <option value="32">32</option>
    <option value="33">33</option>
    <option value="34">34</option>
    <option value="35">35</option>
    <option value="36">36</option>
    <option value="37">37</option>
    <option value="38">38</option>
    <option value="39">39</option>
    <option value="40">40</option>
    <option value="41">41</option>
    <option value="42">42</option>
    <option value="43">43</option>
    <option value="44">44</option>
    <option value="45">45</option>
    <option value="46">46</option>
    <option value="47">47</option>
    <option value="48">48</option>
    <option value="49">49</option>
    <option value="50">50</option>
    <option value="51">51</option>
    <option value="52">52</option>
    <option value="53">53</option>
    <option value="54">54</option>
    <option value="55">55</option>
    <option value="56">56</option>
    <option value="57">57</option>
    <option value="58">58</option>
    <option value="59">59</option>
</select>

JQuery

var s=$('#time').html().split(':');
alert(s[0]); // I'm getting the value here. How can I set this value in the drop down list?
$("#StartHour option[value='" +s[0] + "']").attr('selected', 'selected');
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:13:44+00:00Added an answer on May 26, 2026 at 8:13 am

    When you call .html() to get the table cell’s content you’re getting all the leading and trailing whitespace as well as the text that you’re interested in; also, you should use .text() instead of .html() just in case. So, just strip out the whitespace using replace:

    var s = $('#time').text().replace(/\s/g, '').split(':');
    

    Demo: http://jsfiddle.net/ambiguous/xmgAu/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If you check this: http://jsfiddle.net/QbMmX/1/ Then you can see that the box(div element) is
Please check out this jsfiddle http://jsfiddle.net/rr4GH/1/ As you can see its a round edge
Please check this one: http://jsfiddle.net/sasindu555/nNyxk/8/ You can see Description , Features and Contact Details
Please check this link http://jsfiddle.net/sasindu555/xaYTt/ I want to stop floating special_features div after scrolling
In this JSFiddle http://jsfiddle.net/JQ6qF/ have I striped down the problem. Try click on Save
I make a jquery validation, problem is here that this part from code first(first
Please check out this link quickly: http://jsfiddle.net/8grSk/ As you can see the text as
Check this link! I am having the hardest time trying to figure out why
Please check this: http://img62.imageshack.us/img62/3598/ieff.png why is it more height than in FF.. i want
UPDATE If you try the form on this link http://jsfiddle.net/Matt_KP/BwmzQ/ the fiddle and select

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.